This has nothing to do with pipes, this is a matter of namespacing.
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.
with pipes i have no experience at all. but they certainly look useful. a()|>b()|>c() looks better than c(b(a())) but i can see the confusion because there are now two ways to pass an argument. but even then a(i,j)|>b(x,y)|>c(z) is still more readable than c(b(a(i,j),x,y),z). now i want this feature in all my favorite languages
The only ML language I have any experience with is OCaml which is statically typed and has pipes.
EDIT: re-reading your last comment it looks like I totally ignored the first part of what you said, but I guess I'm confused. This thread is also probably nested enough, lol.
I really like pipelines but know people who try and make everything a pipeline.
What do you mean by that?