|
|
|
|
|
|
|
|
|
|
xen-api
[Xen-API] [PATCH] forward pipe operator
# HG changeset patch
# User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# Date 1282568287 -3600
# Node ID 630c51dcfc241050ce34303920291b837671cd42
# Parent 08e77bc9468cd5b7e364b86d54140f5b7e33fb61
Adds a forward pipe operator to the higher-order function library. The forward
pipe operator facilitates left-to-right function composition.
Signed-off-by: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
diff -r 08e77bc9468c -r 630c51dcfc24 stdext/fun.ml
--- a/stdext/fun.ml Mon Aug 23 13:56:55 2010 +0100
+++ b/stdext/fun.ml Mon Aug 23 13:58:07 2010 +0100
@@ -17,4 +17,6 @@
let comp2 f g a b = f (g a b)
let (+++) f g a b = comp2 f g a b
+let (|>) a f = f a
+
let ($) f a = f a
diff -r 08e77bc9468c -r 630c51dcfc24 stdext/fun.mli
--- a/stdext/fun.mli Mon Aug 23 13:56:55 2010 +0100
+++ b/stdext/fun.mli Mon Aug 23 13:58:07 2010 +0100
@@ -7,4 +7,6 @@
val comp2 : ('b -> 'c) -> ('a1 -> 'a2 -> 'b) -> ('a1 -> 'a2 -> 'c)
val (+++) : ('c -> 'd) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'd
val (++) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c
+(** Forward pipe operator: facilitates left-to-right function composition. *)
+val (|>) : 'a -> ('a -> 'b) -> 'b
val ($) : ('a -> 'b) -> 'a -> 'b
stdext/fun.ml | 2 ++
stdext/fun.mli | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
xen-api-libs.hg.patch
Description: Text Data
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-API] [PATCH] forward pipe operator,
David Scott <=
|
|
|
|
|