Browse thread
[Caml-list] printf hook
[
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: | 2002-06-26 (15:48) |
From: | Remi VANICAT <vanicat@l...> |
Subject: | Re: [Caml-list] printf hook |
"Nicolas Cannasse" <warplayer@free.fr> 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 = <fun> 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