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
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: 2006-01-12 (15:51)
From: Bill Wood <william.wood3@c...>
Subject: Re: [Caml-list] Request for comments: Printf list conversion
On Thu, 2006-01-12 at 10:19 +0100, Alessandro Baretta wrote:
   . . .
> What do you guys think about all this?

Just a comment.  I've been anticipating getting into something like this
since I started considering OCaml as a work-horse language.  I've gone
through this exercise several times -- When I worked in Prolog, I hacked
together a list formatter; after using Scheme a while I hacked out a
list formatter package (and I'm dreading doing it yet again :-).  The
thing is, it's so terribly useful.

I'm always inspired in my hacks by Common Lisp's (format...) form, which
includes a ~{/~} pair containing conversion directives and that consumes
a list argument.  I don't want to appall you with complexity too soon,
but when you think about this, consider the possibility that the list is
a list of lists, each of which contains several items that are to be
formatted using a a recursively specified (sub) format.  This does
enhance usability a great deal.  I'm sure that there are people who will
yelp in protest at this, but I do recommend looking at CL's format as at
least one point in this design space.

Good luck; I eagerly await your results :-)

 -- Bill Wood