Right. what confuses me is, how the format type has 'a -> 'b instead of 'a. On Feb 9, 2015 4:25 AM, "John F Carr" wrote: > Your wrapper returns a function. Type ‘a, the argument to that function, > is determined by the first %-conversion in the format string. The function > returns type ‘b. If your format argument has one %-conversion, type ‘b > will be a string. If it has more than one, type ‘b will be a function > accepting the remaining arguments. > > # let g = f “%d %d”;; > val g : int -> int -> string = > # let h = g 0;; > val h : int -> string = > # h 1;; > - : string = "0 1" > > In the past partial application of printf family functions hasn’t worked > well, so test before relying on behavior of the returned function. > > > On Feb 9, 2015, at 06:58 , Jiten Pathy wrote: > > > > When i define a wrapper around format functions like > > > > let f s = (fun x -> Printf.sprintf s x);; > > > > val f : ('a -> 'b, unit, bytes) format -> 'a -> 'b = > > > > I am confused about the inferred type. where does this 'b comes from? > > > > -- > > Caml-list mailing list. Subscription management and archives: > > https://sympa.inria.fr/sympa/arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs > >