Browse thread
mixing infix functions and the format4 types
-
Anil Madhavapeddy
-
Zheng Li
- Anil Madhavapeddy
-
Zheng Li
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Anil Madhavapeddy <anil@r...> |
| Subject: | Re: [Caml-list] Re: mixing infix functions and the format4 types |
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