dragonfly02
dragonfly02

Reputation: 3669

F# backward pipeline operator with multiple parameters

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

Upvotes: 3

Views: 866

Answers (1)

John Palmer
John Palmer

Reputation: 25516

so you have

minus <| x <| y
=minus x <| y
=(minus x) y
=minus x y

Upvotes: 2

Related Questions