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 AAA25294; Wed, 15 Sep 2004 00:08:38 +0200 (MET DST) 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 AAA26779 for ; Wed, 15 Sep 2004 00:08:37 +0200 (MET DST) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id i8EM8Rmv019846 for ; Wed, 15 Sep 2004 00:08:27 +0200 Received: (qmail 6510 invoked by uid 65534); 14 Sep 2004 22:08:27 -0000 Received: from D9c5c.d.pppool.de (EHLO d9c5c.d.pppool.de) (80.184.156.92) by mail.gmx.net (mp005) with SMTP; 15 Sep 2004 00:08:27 +0200 X-Authenticated: #20477425 From: Micha To: caml-list@inria.fr Subject: Re: [Caml-list] Passing printf format strings to functions Date: Wed, 15 Sep 2004 00:08:34 +0200 User-Agent: KMail/1.6.1 References: <20040915075547.54c0bef6.ocaml-erikd@mega-nerd.com> In-Reply-To: <20040915075547.54c0bef6.ocaml-erikd@mega-nerd.com> Cc: Erik de Castro Lopo MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200409150008.34253.micha-1@fantasymail.de> X-Loop: caml-list@inria.fr X-Spam: no; 0.00; micha:01 caml-list:01 passing:01 printf:01 2004:99 fmt:01 endline:01 printf:01 fmt:01 pervasives:01 val:01 schrieb:01 rec:01 exists:01 string:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, Am Tuesday 14 September 2004 23:55 schrieb Erik de Castro Lopo: > Hi all, > let rec print_string_pairs (fmt:string) = > function > [] -> print_endline "" > > | a :: b -> > > Printf.printf fmt (fst a) (snd a) ; > print_string_pairs fmt b > ;; I think the fmt variable has not to be of type string but of some format type. there exists a conversion function in Pervasives: val format_of_string : ('a, 'b, 'c, 'd) format4 -> ('a, 'b, 'c, 'd) format4 (*format_of_string s returns a format string read from the string literal s.*) Michael ------------------- 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