2 ms·
A |> B |> C second_param Is the same as: C(B(A()), second_param) It's much more powerful than that because you can create chains of functions that pipe t
by andy_ppp 10y ago
A |> B |> C second_param
Is the same as:
C(B(A()), second_param)
It's much more powerful than that because you can create chains of functions that pipe their output i.e.
Some_data
|> fetch_reports
|> email_users
|> setup_notifications
|> IO.inspect
|> affirm_elixir_pipes
It's 100% not the same as dot or arrow! IO.inspect allows you to print details of any data being passed but also returns the first argument passed.
Hope this is a clear explanation of what is happening.
- idobai 10y agoI know how the pipe op works because I've used languages with that operator(f#) but I never had the need for it for ex. in Scala. In Scala a very similar solution has been implemented but nobody uses it.