]> xenbits.xensource.com Git - xcp/xen-api-libs.git/commitdiff
Adds a forward pipe operator to the higher-order function library. The forward pipe...
authorJonathan Knowles <jonathan.knowles@eu.citrix.com>
Mon, 23 Aug 2010 12:58:07 +0000 (13:58 +0100)
committerJonathan Knowles <jonathan.knowles@eu.citrix.com>
Mon, 23 Aug 2010 12:58:07 +0000 (13:58 +0100)
Signed-off-by: Jonathan Knowles <jonathan.knowles@eu.citrix.com>
stdext/fun.ml
stdext/fun.mli

index a8be363d5b0a93c026cb318dbd444e73fc08eb32..4088caca3f58ce3eabe06d306447eae506c80cc9 100644 (file)
@@ -17,4 +17,6 @@ let (++) f g x = comp f g x
 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
index 66cc846682562498d55a11b3b0810e3ee69096f6..e563ed05caf89529c757b7d19444767b7f0b53d5 100644 (file)
@@ -7,4 +7,6 @@ val comp : ('b -> 'c) -> ('a -> 'b) -> ('a -> 'c)
 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