I don't usually use pipeline if the arguments do not match, because I feel that it can hurt the readability. The option by Brian is quite clear, but it is not much different from assigning the result to a value (using let
instead of using pipeline and fun
).
So, I would just write this (without any nice functional magic):
let x = seq { 1 .. 100 } |> Seq.sum
pown x 2
This is essentially the same as Brian's version - you're also assigning the result to a value - but it is more straightforward. I would probably use more descriptive name e.g. sumResult
instead of x
.
The version using flip
is pretty standard thing to do in Haskell - though I also thing that it may become difficult to read (not in this simple case, but if you combine multiple functions, it can easily become horrible). That's I think also a reason why flip
(and others) are missing in the F# libraries.