From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Adrien Nader <adrien@notk.org>
Cc: Francois Berenger <francois.berenger@inria.fr>,
OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Is it possible to define a Printf.sprintf-like that is lazy?
Date: Tue, 28 Oct 2014 10:46:36 +0100 [thread overview]
Message-ID: <CAPFanBGUXV1xR_BPiytsiSKCAkH9+h-Ty70fJH4R06nYOsNA4Q@mail.gmail.com> (raw)
In-Reply-To: <20141028094301.GA4036@notk.org>
let delayed_sprintf fmt = Printf.sprintf (fmt ^^ "%s");;
# let result = Printf.sprintf "%d) %s\n" 3 "foo";;
val result : string = "3) foo\n"
# let thunk = delayed_sprintf "%d) %s\n" 3 "foo";;
val thunk : string -> string = <fun>
# thunk "";;
- : string = "3) foo\n"
On Tue, Oct 28, 2014 at 10:43 AM, Adrien Nader <adrien@notk.org> wrote:
> Hi
>
> On Tue, Oct 28, 2014, Francois Berenger wrote:
>> Hello,
>>
>> I mean, the parameters are not formated unless the function is forced.
>
>
> Have you looked at Printf.kfprintf and ikprintf (which is >= 4.00
> iirc) ?
>
> --
> Adrien Nader
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
next prev parent reply other threads:[~2014-10-28 9:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-28 9:27 Francois Berenger
2014-10-28 9:43 ` Adrien Nader
2014-10-28 9:46 ` Gabriel Scherer [this message]
2014-10-28 9:44 ` Paolo Donadeo
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=CAPFanBGUXV1xR_BPiytsiSKCAkH9+h-Ty70fJH4R06nYOsNA4Q@mail.gmail.com \
--to=gabriel.scherer@gmail.com \
--cc=adrien@notk.org \
--cc=caml-list@inria.fr \
--cc=francois.berenger@inria.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