Partial application of Infix functions in F #

In haskell, you can partially apply the infix function using partitions, for example, given the infix <(less) function, you can partially apply any of the function arguments: (5 <), (<5)

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

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

Does F # have a similar concept?

+3
source share
2 answers

No, none of them (except for a standard partial application, such as (=) x).


While I like compactness Seq.find ((=) x), things like Seq.filter ((<) 3)(or even Seq.map (flip (-) 1)) are simply inconvenient to read and should be replaced immediately with a lambda expression, imo.

+5

...

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

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

, , , .

+4

Source: https://habr.com/ru/post/1727060/


All Articles