Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Printf question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-05-18 (01:21)
From: Brian Hurt <brian.hurt@q...>
Subject: [Caml-list] Printf question

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")


let debug s = let t = "FOO: " ^ s ^ "\n" in Printf.printf s

and neither works.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: