From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A0ED2BBA7 for ; Fri, 13 Jan 2006 09:48:15 +0100 (CET) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k0D8mFeJ002390 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 13 Jan 2006 09:48:15 +0100 Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id E912A202474; Fri, 13 Jan 2006 09:48:14 +0100 (CET) Received: from pc9-152 (pc9-152 [129.175.9.152]) by smtp.lri.fr (Postfix) with ESMTP id 68ECFCED9E; Fri, 13 Jan 2006 09:48:14 +0100 (CET) Received: from filliatr by pc9-152 with local (Exim 3.36 #1 (Debian)) id 1ExKb2-0005gl-00; Fri, 13 Jan 2006 09:47:44 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17351.26923.696839.268229@gargle.gargle.HOWL> Date: Fri, 13 Jan 2006 09:47:39 +0100 To: Virgile Prevosto Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Request for comments: Printf list conversion In-Reply-To: <20060112142710.3baabb9b@localhost.localdomain> References: <43C61F1F.4030101@barettadeit.com> <17350.10156.454589.275252@gargle.gargle.HOWL> <9A1DDF7A-B006-4DE7-B44D-7866F3D5D525@inria.fr> <20060112142710.3baabb9b@localhost.localdomain> X-Mailer: VM 7.19 under Emacs 21.4.1 From: Jean-Christophe Filliatre X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at nez-perce with ID 43C7694F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 printf:01 filliatre:01 filliatr:01 lri:01 val:01 separators:01 printf:01 fmt:01 fprintf:01 fmt:01 precisely:01 comma:02 element:02 guess:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 > > > val print_list : > > > ?sep:(formatter -> unit -> unit) -> > > > (formatter -> 'a -> unit) -> formatter -> 'a list -> unit > > > > > Yuck. Isn't this type (formatter -> unit -> unit) isomorphic to string, > > in the absence of side-effects? Or do you really need separators that > > behave differently depending on the state of some reference? > > With Format, yes: you may want to use the pretty-printing features of the > module, and for instance add a break hint after each element of the list. > For Printf, on the other hand, I guess that a string would be good enough Yes, that's precisely what I'm doing: let comma fmt () = fprintf fmt ",@ " ... -- Jean-Christophe