3 ms·
In some languages there is a pipe operator that does the job well. Elixir example: "foo-bar" |> String.split("-") IMO method chaining is a lot better this
by gamache 4y ago
In some languages there is a pipe operator that does the job well. Elixir example:
"foo-bar" |> String.split("-")
IMO method chaining is a lot better this way, much less desire for monkey patching, etc.
- xigoi 4y agoThere's no need for monkey patching in Nim. x.f(y) is fully equivalent to f(x,y). The functional approach requires currying and data-last parameter order, which are both unidiomatic in Nim.
- gamache 4y agoThanks, TIL! Obviously I have no experience in Nim. This convention reminds me of Perl, which works much the same way. How is it possible, then, to call a function that lives in a different namespace as part of a dot-chain of methods? The Elixir approach does not rely on currying; like much of the language's fancy parts, it's a macro.