[
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: | Jean-Christophe Filliatre <filliatr@l...> |
| Subject: | Re: [Caml-list] printf hook |
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 ?
You can do the following :
======================================================================
# open Printf;;
# let print x = printf "BEGIN: "; printf x;;
======================================================================
but this function still expects a format as first argument :
======================================================================
# print "foo\n";;
BEGIN: foo
- : unit = ()
# print "foo = %d\n" 2;;
BEGIN: foo = 2
- : unit = ()
# print "foo = %d * %d\n" 2 3;;
BEGIN: foo = 2 * 3
- : unit = ()
======================================================================
--
Jean-Christophe
-------------------
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