by StackOverlord · 3y ago · 0 comments
This has nothing to do with pipes, this is a matter of namespacing.
" hello world "
|> String.trim()
|> String.split()
|> Enum.map(fn char -> String.uppercase(char) end)
|> Enum.join()
#=> "HELLO WORLD"
I'm sure some will think that is too verbose but I love it. Otherwise pipes are far more flexible than method chaining just because you aren't constrained to one "type". You don't always want to do this, but as per the example above, it's pretty handy. You also don't have to rely on a method you don't own returning an instance of itself.but for example in pike import is only useful as a shortcut, and not needed if you use fully qualified function calls. and like you i never saw the point of import. using the fully qualified function calls makes the code more readable because i can quickly recognize library functions from custom code.