From: Matthieu Dubuget <matthieu.dubuget@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] I never succeeded in using Format
Date: Thu, 06 Mar 2014 17:34:48 +0100 [thread overview]
Message-ID: <5318A3A8.8050402@gmail.com> (raw)
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
next reply other threads:[~2014-03-06 16:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 16:34 Matthieu Dubuget [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5318A3A8.8050402@gmail.com \
--to=matthieu.dubuget@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox