Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Archives:
Bug reports: FAQ:
Beginner's list: