Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# backward pipeline operator with multiple parameters

Tags:

f#

Just started learning F# and am currently reading "The Book Of F#". Maybe I am missing something but as far as I know forward/backward pipeline operators are passing the result of an expression into the last parameter of the next function in a forward/backward direction. But why does this work? It passes y to x (treating x as a function) first then pass x y into the last parameter e.g. b of minus. So it should return a closure not an int. But backwardTest 3 2 returns 1.

let backwardTest x y = 
    let minus a b = a - b
    minus <| x <| y
like image 960
stt106 Avatar asked Nov 26 '25 13:11

stt106


1 Answers

so you have

minus <| x <| y
=minus x <| y
=(minus x) y
=minus x y
like image 153
John Palmer Avatar answered Nov 30 '25 04:11

John Palmer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!