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] pretty printers and format and matrices
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-06-14 (06:46)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: [Caml-list] pretty printers and format and matrices
> >Once one gets used to it, it's really fun so don't give up...
> I had the choice of "try to get the formatting working for no other
> reason than curiosity" or "write more real code on my game", so the
> latter edged it out.  :) 
> > let print2d ppf a =
> This works better, thanks!  I swear I tried something exactly like that...
> There's a tiny bit of weirdness with the tabs after the first
> column, but it's way better than what I had.  I definitely tried the
> @\n, but I admit I was randomly typing at that point.  The docs
> could stand to be a bit clearer on newlines versus breaks.  Perhaps
> your print2d would make a good complementary tutorial to the
> expression printer in the FAQ... 
> Thanks,
> Chris

Have you read the special paragraph devoted to Format in the FAQ ?

It says somewhere:

When writing a pretty-printing routine, follow these simple rules: 

4.Don't try to force line breaking, let the pretty-printer do it for
you: that's its only job. 
5.End your main program by a print_newline () call, that flushes the
pretty-printer tables (hence the ouput). (Note that the toplevel loop
of the interactive system does it as well, just before a new input.) 

Best regards,

Pierre Weis

INRIA, Projet Cristal,,

Bug reports:  FAQ:
To unsubscribe, mail  Archives: