Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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"

or

   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