defmacro into(a, b) do
{:=, [line: 1], [b, a]}
end
|> (into b)
a
|> fn1
|> fn2
|=> b
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/1b11f727-fd6a-4467-8754-5eb4649c432c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have since decided it's a bad idea.
There are many ways to extend Elixir 'irresponsbly' making code that is not clear and readable like core Elixir is. So by adding features like extended pipes and iteratable tuples (both interesting in isolation), we discover that actually 'less is more'
For reference: https://gist.github.com/tallakt/a6701b1e5c2808c85104
See the test at the end for usage example
def myfun(x, y) do
a =
x
|> fun_1
|> fun_2
b =
y
|> fun_3
|> fun_4
# now do something with a and b, e.g.:
%myStruct{foo: a * b}
end
def myfun(x, y) do
a = subfun(x)
b = subfun_b(y)
# now do something with a and b, e.g.:
%myStruct{foo: a * b}
end
defp subfun_a(x) do
x
|> fun_1
|> fun_2
end
defp subfun_b(y) do
y
|> fun_3
|> fun_4
end