Version française
Home     About     Download     Resources     Contact us    
Browse thread
Printf issues
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Philippe Wang <lists@p...>
Subject: Re: [Caml-list] Printf issues
Till Varoquaux wrote:
> I having typing issues with sprintf:
>
> # Printf.sprintf "%a";;
> - : (unit -> '_a -> string) -> '_a -> string = <fun>
>
> whereas:
>
> # Printf.printf "%a";;
> - : (out_channel -> '_a -> unit) -> '_a -> unit = <fun>
>
> Am I missing something out here? If not why can't sprintf accept the
> same printers as the other?

Probably because it's not meant to be as you want it to be!
Why should sprintf take a function to output something on a channel 
whereas it's used to return a string?

...

Cheers,
 Philippe