From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA08146; Sun, 26 Oct 2003 13:33:28 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA08080 for ; Sun, 26 Oct 2003 13:33:27 +0100 (MET) Received: from mwinf0404.wanadoo.fr (smtp4.wanadoo.fr [193.252.22.27]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h9QCXQ118116 for ; Sun, 26 Oct 2003 13:33:26 +0100 (MET) Received: from debian (ca-bordeaux-18-30.w80-8.abo.wanadoo.fr [80.8.90.30]) by mwinf0404.wanadoo.fr (SMTP Server) with ESMTP id 725AE38000CB; Sun, 26 Oct 2003 13:33:26 +0100 (CET) Received: from moi by debian with local (Exim 3.36 #1 (Debian)) id 1ADk5G-0002ye-00; Sun, 26 Oct 2003 13:33:26 +0100 To: Richard Jones Cc: caml-list@inria.fr Subject: Re: [Caml-list] Missing tabs References: <20031026115935.GA6205@redhat.com> From: Remi Vanicat Mail-Copy-To: never Date: Sun, 26 Oct 2003 13:33:25 +0100 In-Reply-To: <20031026115935.GA6205@redhat.com> (Richard Jones's message of "Sun, 26 Oct 2003 11:59:35 +0000") Message-ID: <87wuasrxey.dlv@wanadoo.fr> User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 3.07:01 printf:01 printf:01 foo:01 baz:01 foo:01 baz:01 ocaml:01 caml:01 command:98 labri:01 u-bordeaux:01 writes:01 remi:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Richard Jones 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