From: Matthias Goergens Date: Tue, 2 Feb 2010 15:42:13 +0000 (+0000) Subject: Module Fun gets operators for function composition and application. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=12089933b8b08ebf11cce674bc218b5daebdf5d9;p=xcp%2Fxen-api-libs.git Module Fun gets operators for function composition and application. Exposes function composition (++) and function composition with two arguments (+++) to the Fun module of our extended standard library. Adds and exposes function application ($). Signed-off-by: Matthias Goergens --- diff --git a/stdext/fun.ml b/stdext/fun.ml index 8cd5d9a..9510406 100644 --- a/stdext/fun.ml +++ b/stdext/fun.ml @@ -16,3 +16,5 @@ 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 ($) f a = f a diff --git a/stdext/fun.mli b/stdext/fun.mli index 634d946..c4da946 100644 --- a/stdext/fun.mli +++ b/stdext/fun.mli @@ -4,3 +4,6 @@ val id : 'a -> 'a val flip : ('a -> 'b -> 'c) -> ('b -> 'a -> 'c) val on : ('b -> 'b -> 'c) -> ('a -> 'b) -> 'a -> 'a -> 'c val comp : ('b -> 'c) -> ('a -> 'b) -> ('a -> 'c) +val (+++) : ('c -> 'd) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'd +val (++) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c +val ($) : ('a -> 'b) -> 'a -> 'b \ No newline at end of file