Version française
Home     About     Download     Resources     Contact us    
Browse thread
Request for comments: Printf list conversion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Christophe Filliatre <filliatr@l...>
Subject: Re: [Caml-list] Request for comments: Printf list conversion

 > > >   val print_list :
 > > >     ?sep:(formatter -> unit -> unit) ->
 > > >     (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
 > > >
 > > Yuck.  Isn't this type (formatter -> unit -> unit) isomorphic to string,
 > > in the absence of side-effects?  Or do you really need separators that
 > > behave differently depending on the state of some reference?
 > 
 > With Format, yes: you may want to use the pretty-printing features of the
 > module, and for instance add a break hint after each element of the list.
 > For Printf, on the other hand, I guess that a string would be good enough

Yes, that's precisely what I'm doing:

  let comma fmt () = fprintf fmt ",@ "
  ...

-- 
Jean-Christophe