caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] isn't iksprintf missing in the stdlib?
@ 2013-12-26  7:59 Francois Berenger
  2013-12-26 11:24 ` Daniel Bünzli
  0 siblings, 1 reply; 3+ messages in thread
From: Francois Berenger @ 2013-12-26  7:59 UTC (permalink / raw)
  To: caml-list

Cf. http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html

Is it possible to write one out of the Printf module?

Best regards,
Francois.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] isn't iksprintf missing in the stdlib?
  2013-12-26  7:59 [Caml-list] isn't iksprintf missing in the stdlib? Francois Berenger
@ 2013-12-26 11:24 ` Daniel Bünzli
  2013-12-26 11:48   ` Jonathan Protzenko
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Bünzli @ 2013-12-26 11:24 UTC (permalink / raw)
  To: Francois Berenger; +Cc: caml-list



Le jeudi, 26 décembre 2013 à 08:59, Francois Berenger a écrit :

> Cf. http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html
>  
> Is it possible to write one out of the Printf module?
Maybe not. But at least from the Format module using `Format.iksprintf` with `Format.std_formatter`.  

Best,

Daniel



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] isn't iksprintf missing in the stdlib?
  2013-12-26 11:24 ` Daniel Bünzli
@ 2013-12-26 11:48   ` Jonathan Protzenko
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Protzenko @ 2013-12-26 11:48 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: caml-list, Francois Berenger

Hi,

If I'm not mistaken, and assuming you're using -rectypes, you can write:

# let rec iksprintf k f = iksprintf;;
val iksprintf : 'b -> 'c -> 'a as 'a = <fun>

which is unifiable with the type of Printf.ksprintf

# if true then Printf.ksprintf else iksprintf;;
- : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a as 'a = <fun>

Cheers,

~ jonathan

On Thu 26 Dec 2013 12:24:53 PM CET, Daniel Bünzli wrote:
>
>
> Le jeudi, 26 décembre 2013 à 08:59, Francois Berenger a écrit :
>
>> Cf. http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html
>>
>> Is it possible to write one out of the Printf module?
> Maybe not. But at least from the Format module using `Format.iksprintf` with `Format.std_formatter`.
>
> Best,
>
> Daniel
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-26 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-26  7:59 [Caml-list] isn't iksprintf missing in the stdlib? Francois Berenger
2013-12-26 11:24 ` Daniel Bünzli
2013-12-26 11:48   ` Jonathan Protzenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).