Question

In haskell it is posible to partially apply an infix function using sections, for instance given the infix function < (less than) one can partially apply any of the function's arguments: (5 <) , (< 5)

In other words, in haskell we have the following shorthand notation:

op :: a -> b -> c
(`op` y) === \x -> x `op` y
(x `op`) === \y -> x `op` y

Does F# have a similar concept?

Was it helpful?

Solution

No, neither of those (apart from standard partial application like (=) x).


Whereas I like the succinctness of Seq.find ((=) x), things like Seq.filter ((<) 3) (or even Seq.map (flip (-) 1)) are simply awkward to read and should immediately be replaced by a lambda expression, imo.

OTHER TIPS

If you want to invent your own standards...

let lsection x f y -> f x y
let rsection f y x -> f x y

Then lsection 5 (<) === (5 <) and rsection (<) 5 === (< 5).

Though really, without language support, just put a lambda in there and it'll be clearer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top