Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: caml-list@inria.fr, warplayer@free.fr
Subject: Re:  [Caml-list] printf hook
Date: Wed, 26 Jun 2002 18:31:58 +0200 (MET DST)	[thread overview]
Message-ID: <200206261631.SAA0000026929@beaune.inria.fr> (raw)

>From: "Nicolas Cannasse" <warplayer@free.fr>
>
>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.)

-- Damien
-------------------
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


             reply	other threads:[~2002-06-26 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-26 16:31 Damien Doligez [this message]
2002-06-26 16:46 ` Nicolas Cannasse
  -- strict thread matches above, loose matches on Subject: below --
2002-06-26 15:01 Nicolas Cannasse
2002-06-26 15:21 ` Jean-Christophe Filliatre
2002-07-12 10:21   ` Nicolas Cannasse
2002-07-12 12:41     ` Pierre Weis
2002-06-26 15:51 ` Remi VANICAT

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200206261631.SAA0000026929@beaune.inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=warplayer@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox