caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Format questions
@ 2017-04-08 20:52 Matej Kosik
  2017-04-08 22:24 ` Josh Berdine
  0 siblings, 1 reply; 4+ messages in thread
From: Matej Kosik @ 2017-04-08 20:52 UTC (permalink / raw)
  To: caml-list

Hi everybody,

I am trying to understand the concepts in the Format module.

While reading this:

  https://ocaml.org/learn/tutorials/format.html

One of the mini experiments I did was:

  set_margin 11;
  open_hvbox 0;
  print_string "---";
  print_space ();
  print_string "---";
  print_space ();
  print_string "---";
  print_newline ();
  print_newline ();

I've got the expected output, which is:

  ---
  ---
  ---

No surprises.

However, when I tried to write express the same intentions via Format.fprintf function:

  Format.set_margin 11;
  Format.fprintf std_formatter "@[<hv 0>---@ ---@ ---@.@.";

I get:

  --- --- ---

I'd like to ask for some clues as to why the output of the above Format.fprintf is different from the more verbose version above.

(this is the one module that, to this day, seems a bit mysterious to me --- that is why I ask)

Thanks in advance for the help.

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

end of thread, other threads:[~2017-04-09  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-08 20:52 [Caml-list] Format questions Matej Kosik
2017-04-08 22:24 ` Josh Berdine
2017-04-09  7:44   ` Matej Kosik
2017-04-09  7:45     ` Nicolás Ojeda Bär

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).