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 MAA21025; Fri, 12 Jul 2002 12:22:14 +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 MAA21019 for ; Fri, 12 Jul 2002 12:22:13 +0200 (MET DST) Received: from mel-rto4.wanadoo.fr (smtp-out-4.wanadoo.fr [193.252.19.23]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6CAMCf19840 for ; Fri, 12 Jul 2002 12:22:13 +0200 (MET DST) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rto4.wanadoo.fr (6.5.007) id 3D18589F00997A55; Fri, 12 Jul 2002 12:22:07 +0200 Received: from warp (217.128.142.232) by mel-rta7.wanadoo.fr (6.5.007) id 3D2A78FA001CA842; Fri, 12 Jul 2002 12:22:07 +0200 Message-ID: <004001c2298d$de86f7f0$3700a8c0@warp> From: "Nicolas Cannasse" To: "Jean-Christophe Filliatre" Cc: "OCaml" References: <000f01c21d22$5f6a97f0$a500a8c0@warp> <15641.56327.11995.84537@pc803.lri.fr> Subject: Re: [Caml-list] printf hook Date: Fri, 12 Jul 2002 12:21:20 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > 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;; I just found something quite funny : let print x = printf "BEGIN"; printf x; flush stdout print "test";; print "%d" 10; (** TOO MUCH ARGS **) ============ let print x = printf "BEGIN"; let r = printf x in flush stdout; r print "test"; print "%d" 10; (** WORKING **) NC ------------------- 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