Browse thread
[Caml-list] Printf question
- Brian Hurt
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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")
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