lambda - Not Function And Function Composition in F# -
is possible f# have function composition between operators.not
, standard .net function, instance string.isnullorempty
?
in other words, why following lambda expression unacceptable:
(fun x -> not >> string.isnullorempty)
the >>
function composition works other way round - passes result of function on left function on right - snippet passing bool
isnullorempty
, type error. following works:
(fun x -> string.isnullorempty >> not)
or can use reversed function composition (but think >>
preferred in f#):
(fun x -> not << string.isnullorempty)
aside, snippet creating function of type 'a -> string -> bool
, because ignoring argument x
. suppose might want just:
(string.isnullorempty >> not)