by tzs · 4y ago · 0 comments
const y = h(g(f(x))); // no pipe
const y = x |> f(%) |> g(%) |> h(%); // Hack pipe
const y = x |> f |> g |> h; // F# pipe
Why not use concatenation? const y = x f g h;This can't be broken into multiple lines.
const y = x f
g h
Will have an implicit ; in between. const y = x
|> f
|> g
|> h;
Will work as expected, and potentially increase readability.Languages with implicit string concatenation using no operator have found it to be a common source of bugs, eg python. See https://news.ycombinator.com/item?id=29841560
value |> someFunction(1, %, 3)h g f x
and keep the ordering of functions the same between the different syntactical structures.