Hacker News new | ask | show | jobs
by TranquilMarmot 3918 days ago
You can do this in other languages just the same with maybe some different syntax, for example C#

"moo".Replace('m', 'z').ToUpper();

Or, fully qualified with "every method in its own namespaced module";

"moo".(string.Replace('m', 'z')).(string.ToUpper());

I'm not sure if elixir is doing anything fancy here that I'm not seeing, though. I still haven't had a chance to try it out.

1 comments

It's a macro. It takes the result of the prior operation and inserts it as the first parameter of the next operation.

More or less it rewrites

    String.downcase("FOO\0BAR") |> String.split("\0")
to

    String.split(String.downcase("FOO\0BAR"), "\0")