caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] Format questions
Date: Sat, 8 Apr 2017 22:52:03 +0200	[thread overview]
Message-ID: <925865e7-4237-0bcb-b4bf-76ca7d5e183e@gmail.com> (raw)

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.

             reply	other threads:[~2017-04-08 20:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08 20:52 Matej Kosik [this message]
2017-04-08 22:24 ` Josh Berdine
2017-04-09  7:44   ` Matej Kosik
2017-04-09  7:45     ` Nicolás Ojeda Bär

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=925865e7-4237-0bcb-b4bf-76ca7d5e183e@gmail.com \
    --to=5764c029b688c1c0d24a2e97cd764f@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;
as well as URLs for NNTP newsgroup(s).