From: Josh Berdine <josh@berdine.net>
To: Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com>,
"caml-list\@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Format questions
Date: Sat, 08 Apr 2017 23:24:22 +0100 [thread overview]
Message-ID: <jk60ig1st2bkrt.fsf@fb.com> (raw)
In-Reply-To: <925865e7-4237-0bcb-b4bf-76ca7d5e183e@gmail.com>
On Sat, Apr 08 2017, Matej Kosik wrote:
> 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.
Are you, by chance, evaluating this in utop (which seems to mess with std_formatter)? I see your expected behavior using the standard toplevel. (After adding Format. to std_formatter)
next prev parent reply other threads:[~2017-04-08 22:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-08 20:52 Matej Kosik
2017-04-08 22:24 ` Josh Berdine [this message]
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=jk60ig1st2bkrt.fsf@fb.com \
--to=josh@berdine.net \
--cc=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