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 RAA17239; Wed, 26 Jun 2002 17:31:12 +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 RAA17650 for ; Wed, 26 Jun 2002 17:31:11 +0200 (MET DST) Received: from lri.lri.fr (lri.lri.fr [129.175.15.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g5QFVA509386 for ; Wed, 26 Jun 2002 17:31:11 +0200 (MET DST) Received: from pc803.lri.fr (mail@pc803 [129.175.8.114]) by lri.lri.fr (8.11.6/jtpda-5.3.2) with ESMTP id g5QFLic09226 ; Wed, 26 Jun 2002 17:21:44 +0200 (MEST) Received: from filliatr by pc803.lri.fr with local (Exim 3.33 #1 (Debian)) id 17NEc3-0001up-00; Wed, 26 Jun 2002 17:21:43 +0200 From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15641.56327.11995.84537@pc803.lri.fr> Date: Wed, 26 Jun 2002 17:21:43 +0200 (MEST) To: "Nicolas Cannasse" Cc: "OCaml" Subject: Re: [Caml-list] printf hook In-Reply-To: <000f01c21d22$5f6a97f0$a500a8c0@warp> References: <000f01c21d22$5f6a97f0$a500a8c0@warp> X-Mailer: VM 6.49 under Emacs 20.7.2 Reply-To: Jean-Christophe.Filliatre@lri.fr (Jean-Christophe Filliatre) X-MailScanner: Found to be clean Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Nicolas Cannasse writes: > Hi list ! > I would like do to something like this : > > let sprint msg = > print_endline ("BEGIN: "^(sprintf msg)) > > without of course loosing the ability of having variable number of > parameters in my "msg". > Is that kind of thing possible ? You can do the following : ====================================================================== # open Printf;; # let print x = printf "BEGIN: "; printf x;; ====================================================================== but this function still expects a format as first argument : ====================================================================== # print "foo\n";; BEGIN: foo - : unit = () # print "foo = %d\n" 2;; BEGIN: foo = 2 - : unit = () # print "foo = %d * %d\n" 2 3;; BEGIN: foo = 2 * 3 - : unit = () ====================================================================== -- Jean-Christophe ------------------- 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