caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] string to Printf format type conversion
@ 2012-11-30  9:19 Francois Berenger
  2012-11-30  9:45 ` Malcolm Matalka
  2012-11-30 14:32 ` Edgar Friendly
  0 siblings, 2 replies; 3+ messages in thread
From: Francois Berenger @ 2012-11-30  9:19 UTC (permalink / raw)
  To: Caml-list

Hello,

Is it possible to have:

---
open Printf
module C = Color

(* this *)
fprintf out (C.to_string_format color);
(* instead of *)
fprintf out "%s" (C.to_string color);
---

What should be the code of to_string_format
if it is possible to do so?

Thanks a lot,
F.

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

* Re: [Caml-list] string to Printf format type conversion
  2012-11-30  9:19 [Caml-list] string to Printf format type conversion Francois Berenger
@ 2012-11-30  9:45 ` Malcolm Matalka
  2012-11-30 14:32 ` Edgar Friendly
  1 sibling, 0 replies; 3+ messages in thread
From: Malcolm Matalka @ 2012-11-30  9:45 UTC (permalink / raw)
  To: Francois Berenger; +Cc: Caml-list

If you want the equivalent of fprintf out "%s" (C.to_string color); but
with less typing, why not output_string out (C.to_string color) ?

Francois Berenger <berenger@riken.jp> writes:

> Hello,
>
> Is it possible to have:
>
> ---
> open Printf
> module C = Color
>
> (* this *)
> fprintf out (C.to_string_format color);
> (* instead of *)
> fprintf out "%s" (C.to_string color);
> ---
>
> What should be the code of to_string_format
> if it is possible to do so?
>
> Thanks a lot,
> F.

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

* Re: [Caml-list] string to Printf format type conversion
  2012-11-30  9:19 [Caml-list] string to Printf format type conversion Francois Berenger
  2012-11-30  9:45 ` Malcolm Matalka
@ 2012-11-30 14:32 ` Edgar Friendly
  1 sibling, 0 replies; 3+ messages in thread
From: Edgar Friendly @ 2012-11-30 14:32 UTC (permalink / raw)
  To: caml-list

You should be able to chain printfs with:

fprintf out "Color: %a" C.to_string_format color

E.

On 11/30/2012 4:19 AM, Francois Berenger wrote:
> Hello,
>
> Is it possible to have:
>
> ---
> open Printf
> module C = Color
>
> (* this *)
> fprintf out (C.to_string_format color);
> (* instead of *)
> fprintf out "%s" (C.to_string color);
> ---
>
> What should be the code of to_string_format
> if it is possible to do so?
>
> Thanks a lot,
> F.
>


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

end of thread, other threads:[~2012-11-30 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30  9:19 [Caml-list] string to Printf format type conversion Francois Berenger
2012-11-30  9:45 ` Malcolm Matalka
2012-11-30 14:32 ` Edgar Friendly

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).