3 ms·
Also reminds me of Kotlin 'let': val y = h(g(f(x))) is the same as val y = x .let{ f(it) } .let{ g(it) } .let{ h(it) } I hav
by TrianguloY 5y ago
Also reminds me of Kotlin 'let':
val y = h(g(f(x)))
is the same as
val y = x
.let{ f(it) }
.let{ g(it) }
.let{ h(it) }
I have used and loved the pipe operator in Elixir, but always missed using it for functions where the data is the second argument, for example. It's slightly less verbose, but more restricted and more complex to understand. I prefer the JavaScript approach.
In any case, I find it odd using the % as the variable name. Maybe if the operator was x %> f(%), but that probably is an invalid token.