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 RAA18081; Wed, 26 Jun 2002 17:48:21 +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 RAA18187 for ; Wed, 26 Jun 2002 17:48:20 +0200 (MET DST) Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5QFmJn11383 for ; Wed, 26 Jun 2002 17:48:19 +0200 (MET DST) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rto3.wanadoo.fr (6.5.007) id 3D1848E6000FF88A for caml-list@inria.fr; Wed, 26 Jun 2002 17:48:18 +0200 Received: from debian (80.8.80.200) by mel-rta7.wanadoo.fr (6.5.007) id 3D11E59B0031DF5E for caml-list@inria.fr; Wed, 26 Jun 2002 17:48:18 +0200 Received: from moi by debian with local (Exim 3.35 #1 (Debian)) id 17NF4s-0003zY-00 for ; Wed, 26 Jun 2002 17:51:30 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] printf hook References: <000f01c21d22$5f6a97f0$a500a8c0@warp> Mail-Copy-To: never From: Remi VANICAT Date: Wed, 26 Jun 2002 17:51:30 +0200 In-Reply-To: <000f01c21d22$5f6a97f0$a500a8c0@warp> ("Nicolas Cannasse"'s message of "Wed, 26 Jun 2002 17:01:38 +0200") Message-ID: <87lm92f37h.dlv@wanadoo.fr> User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit 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 ? For just this, you could do : let sprint msg = print_string "BEGIN: "; printf msg;; But generally speaking, you need kprintf from the Not yet, it need kprintf that is in the development version of ocaml: # Printf.kprintf;; - : (string -> string) -> ('a, unit, string) format -> 'a = so it would be something as : let sprint msg = let aux res = print_endline ("BEGIN: " ^ res); res in kprintf res msg;; -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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