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 DAA25164; Sun, 18 May 2003 03:21:48 +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 DAA25631 for ; Sun, 18 May 2003 03:21:46 +0200 (MET DST) Received: from epexch01.qlogic.org ([63.170.40.3]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4I1LjH02765 for ; Sun, 18 May 2003 03:21:45 +0200 (MET DST) Received: from epmailtmp.qlogic.org ([10.20.33.254]) by epexch01.qlogic.org with Microsoft SMTPSVC(5.0.2195.5329); Sat, 17 May 2003 20:20:06 -0500 Received: from [10.20.33.146] ([10.20.33.146]) by epmailtmp.qlogic.org with Microsoft SMTPSVC(5.0.2195.4905); Sat, 17 May 2003 20:20:06 -0500 Date: Sat, 17 May 2003 20:34:27 -0500 (CDT) From: Brian Hurt X-X-Sender: Reply-To: Brian Hurt To: Ocaml Mailing List Subject: [Caml-list] Printf question Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 18 May 2003 01:20:06.0297 (UTC) FILETIME=[9D89B890:01C31CDB] X-Spam: no; 0.00; qlogic:01 printf:01 outputs:01 foo:01 prepend:01 debug:01 let:04 define:05 i'd:06 brian:06 basically:06 wrapper:08 function:09 message:89 append:10 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I want to define a wrapper function for printf, basically for debug. I'd like it to work so I can do things like: debug "some message"; (* outputs "FOO: some message\n" *) debug "answer: %d" 42 ; (* outputs "FOO: answer: 42\n" *) basically to prepend "FOO: " and append "\n". Is this possible in any sane manner? I tried: let debug s = Printf.printf ("FOO: " ^ s ^ "\n") and: let debug s = let t = "FOO: " ^ s ^ "\n" in Printf.printf s and neither works. Brian ------------------- 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