Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Partial Application of Infix Functions in F#

Tags:

haskell

func

f#

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?

like image 782
primodemus Avatar asked Sep 05 '25 03:09

primodemus


1 Answers

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.

like image 75
Sebastian Ullrich Avatar answered Sep 08 '25 22:09

Sebastian Ullrich