caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi Vanicat <vanicat@labri.u-bordeaux.fr>
To: Richard Jones <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Missing tabs
Date: Sun, 26 Oct 2003 13:33:25 +0100	[thread overview]
Message-ID: <87wuasrxey.dlv@wanadoo.fr> (raw)
In-Reply-To: <20031026115935.GA6205@redhat.com> (Richard Jones's message of "Sun, 26 Oct 2003 11:59:35 +0000")

Richard Jones <rich@annexia.org> writes:

> $ ocaml
>         Objective Caml version 3.07+2
>
> # open Printf;;
> # List.iter (printf "\t%s\n") ["foo"; "bar"; "baz"; "buz"];;
>         foo
> bar
> baz
> buz
> - : unit = ()
> #
>
> Where did the second and subsequent tabs go? I even tried piping the
> output into the 'hd' shell command, and they are definitely missing.

printf is partially applied : when you do (printf "\t%s\n"), you print
a tab, and return a function that print its string argument and a new
line.

this will make what you want :

List.iter (fun x -> printf "\t%s\n" x) ["foo"; "bar"; "baz"; "buz"];;


-- 
Rémi Vanicat

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      parent reply	other threads:[~2003-10-26 12:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-26 11:59 Richard Jones
2003-10-26 12:17 ` Nicolas George
2003-10-26 15:28   ` Richard Jones
2003-10-27 13:12     ` John Carr
2003-10-26 12:33 ` Remi Vanicat [this message]

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=87wuasrxey.dlv@wanadoo.fr \
    --to=vanicat@labri.u-bordeaux.fr \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    /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).