English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Newbie q. about Arg parsing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-08-19 (16:42)
From: Florian Hars <florian@h...>
Subject: Re: [Caml-list] Newbie q. about Arg parsing
Gerald heinig wrote:
> let intarg = fun i -> Printf.printf "%d"

This function takes an arbitrary value "i", ignores it and then returns

   Printf.printf "%d"

which has type int -> unit, so your intarg has type

   'a -> int -> unit

which is probably not what you wanted (and not wat Arg.Int expects). Try

   let intarg = Printf.printf "%d"


   let intarg i = Printf.printf "%d" i

instead (the latter for should optimize better, but if you parse command line 
arguments in an inner loop you should refactor your program anyway).

Yours, Florian.

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners