caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] I never succeeded in using Format
@ 2014-03-06 16:34 Matthieu Dubuget
  2014-03-06 16:46 ` Jeremy Yallop
  2014-03-06 16:47 ` Benoit Vaugon
  0 siblings, 2 replies; 12+ messages in thread
From: Matthieu Dubuget @ 2014-03-06 16:34 UTC (permalink / raw)
  To: caml-list

Is the following behaviour expected, or a misunderstanding of mine?

In short, I'd like to use the Format module to prepare an
output inside a Buffer.t. But a basic <hov> box does not
break lines as I would expect, while printf does.

OCaml version 4.01.0

# open Format;;
# printf "@[<hov0>111,@,222,@,333,@,444,@,555,@,666@]@.";;
111,222,333,444,555,666
- : unit = ()
# set_margin 9;;
- : unit
= ()
# printf "@[<hov0>111,@,222,@,333,@,444,@,555,@,666@]@.";;
111,222,
333,444,
555,666
- : unit
= ()
# sprintf "@[<hov0>111,@,222,@,333,@,444,@,555,@,666@]@.";;
- : string
=
"111,222,333,444,555,666\n"

Why doesn't sprintf exhibit the same behaviour as printf?
Trying with fprintf…

# fprintf str_formatter "@[<hov0>111,@,222,@,333,@,444,@,555,@,666@]@.";;
- : unit
= ()
# flush_str_formatter ();;
- : string
=
"111,222,333,444,555,666\n"

-- 
Matthieu Dubuget


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-03-14 10:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-06 16:34 [Caml-list] I never succeeded in using Format Matthieu Dubuget
2014-03-06 16:46 ` Jeremy Yallop
2014-03-06 16:47 ` Benoit Vaugon
2014-03-06 17:02   ` Matthieu Dubuget
2014-03-06 17:06     ` David Sheets
2014-03-06 17:09       ` Matthieu Dubuget
2014-03-06 19:08         ` Martin Jambon
2014-03-07  7:20           ` Raphaël Proust
2014-03-10  0:47             ` oleg
2014-03-10 11:28               ` Bob Atkey
2014-03-11  9:32                 ` oleg
2014-03-14 10:21                   ` Francois Pottier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).