4 ms·
You can still do this though: let result = (barbalyze(c, d, $) . foobinade(a, b, $)) input Or if you prefer left-to-right: let result = input |> foob
by emih 6mo ago
You can still do this though:
let result = (barbalyze(c, d, $) . foobinade(a, b, $)) input
Or if you prefer left-to-right:
let result = input
|> foobinade(a, b, $)
|> barbalyze(c, d, $)
Maybe what isn't clear is that this hole operator would bind to the innermost function call, not the whole statement.
- raincole 6mo agoWow, this convinced me. It's so obviously the right approach when you put it this way.
- twic 6mo agoEven better, this method lets you pipeline into a parameter which isn't the last one: let result = input |> add_prefix_and_suffix("They said '", $, "'!")
- raincole 6mo agoYeah, especially in F#, a language that means to interpolate with .Net libraries (most not written with "data input at last" mindset.) now I'm quite surprised that F# doesn't have this feature.
- Smaug123 6mo agoThis is essentially how Mathematica does it: the sugar `Foo[x,#,z]&` is semantically the same as `Function[{y}, Foo[x,y,z]]`. The `&` syntax essentially controls what hole belongs where.