caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anil Madhavapeddy <anil@recoil.org>
To: Zheng Li <zheng_li@users.sourceforge.net>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: mixing infix functions and the format4 types
Date: Mon, 30 Mar 2009 11:45:33 +0100	[thread overview]
Message-ID: <A5EA82DA-AE9D-4A38-9ACA-9DC3BCB4197A@recoil.org> (raw)
In-Reply-To: <49D08C9E.4060707@users.sourceforge.net>

On 30 Mar 2009, at 10:10, Zheng Li wrote:
>
> Is extra separators acceptable?
>
> # let ($) f x = f x;;
> val ( $ ) : ('a -> 'b) -> 'a -> 'b = <fun>
> # "foo" --- "%s %s %s" $ "bar1" $ "bar2" $ "bar3";;
> - : string = "foo: bar1 bar2 bar3"

Aha ... using the identity function like this works great, thanks!

-anil

>
> and, maybe in another way
>
> # let (%) fmt x = Printf.sprintf fmt x;;
> val ( % ) : ('a -> 'b, unit, string) format -> 'a -> 'b = <fun>
> # "%s %s %s" % "bar1" $ "bar2" $ "bar3";;
> - : string = "bar1 bar2 bar3"
>
> HTH.
> --
> Zheng
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


      reply	other threads:[~2009-03-30 10:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-30  0:18 Anil Madhavapeddy
2009-03-30  9:10 ` Zheng Li
2009-03-30 10:45   ` Anil Madhavapeddy [this message]

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=A5EA82DA-AE9D-4A38-9ACA-9DC3BCB4197A@recoil.org \
    --to=anil@recoil.org \
    --cc=caml-list@inria.fr \
    --cc=zheng_li@users.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).