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 KAA18320; Wed, 15 Sep 2004 10:35:24 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA16114 for ; Wed, 15 Sep 2004 10:35:23 +0200 (MET DST) Received: from smtp-2.syd.swiftdsl.com.au (smtp-2.syd.swiftdsl.com.au [218.214.224.98]) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id i8F8ZKnq001601 for ; Wed, 15 Sep 2004 10:35:22 +0200 Received: (qmail 14053 invoked from network); 15 Sep 2004 08:35:31 -0000 Received: from unknown (HELO coltrane.mega-nerd.net) (218.214.64.136) by smtp-2.syd.swiftdsl.com.au with SMTP; 15 Sep 2004 08:35:31 -0000 Received: from coltrane (localhost [127.0.0.1]) by coltrane.mega-nerd.net (Postfix) with SMTP id 221D87AE1 for ; Wed, 15 Sep 2004 18:35:17 +1000 (EST) Date: Wed, 15 Sep 2004 18:35:17 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Subject: Re: [Caml-list] Passing printf format strings to functions Message-Id: <20040915183517.5be257ab.ocaml-erikd@mega-nerd.com> In-Reply-To: <16711.63852.127954.905979@gargle.gargle.HOWL> References: <20040915075547.54c0bef6.ocaml-erikd@mega-nerd.com> <16711.63852.127954.905979@gargle.gargle.HOWL> Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4147FEC8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 passing:01 printf:01 2004:99 filliatre:01 filliatre:01 lri:01 string-:01 string-:01 ahh:01 printf:01 acheive:01 2800:99 sep:01 width:98 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 15 Sep 2004 10:12:28 +0200 Jean-Christophe Filliatre wrote: Thanks Jean-Christophe for a very thorough and well explained response. > Indeed, there is no static way to check that the resulting format is > indeed of type (string->string->'a,'b,'c) format. Ahh, now I understand. With the knowledge you provided and some hacking I did after I sent the original email, I was able to use a constant format string like: Printf.printf " %-*s %s\n" format_width (fst a) (snd a) ;; and acheive the result I desired. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "The earth is degenerating these days. Bribery and corruption abound. Children no longer mind parents ...and it is evident that the end of the world is approaching fast." -- Assyrian Tablet Engraved in 2800 B.C. ------------------- 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