Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 ?

http://pauillac.inria.fr/caml/FAQ/format-eng.html

It says somewhere:

Practice
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, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr