[
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: | Nicolas Cannasse <warplayer@f...> |
| Subject: | Re: [Caml-list] printf hook |
> >let sprint msg =
> > print_endline ("BEGIN: "^(sprintf msg))
> >
> >without of course loosing the ability of having variable number of
> >parameters in my "msg".
>
> If you can wait for 3.05, or if you are willing to use the CVS
> version, you'll be able to write:
>
> let sprint fmt =
> let do_output s = print_endline ("BEGIN: " ^ s); "" in
> Printf.kprintf do_output fmt
> ;;
>
> The tail-call to kprintf allows it to get the extra arguments thanks
> to currying. The do_output function must return a string (which is
> returned by sprint) for technical reasons. (This may change before
> the release.)
Seems nice :)
I'll wait the official release of 3.05 before switching to kprintf.
Thanks to all people who answered.
Nicolas Cannasse
-------------------
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