Pipe Operator Discussions
Comments discuss the pipe or pipeline operator (|) for function chaining and composition, its presence in languages like F#, Elixir, and OCaml, and proposals or desires for it in JavaScript, Python, and others compared to alternatives like method chaining.
Activity Over Time
Top Contributors
Keywords
Sample Comments
There's the pipe operator in a lot of languages (|>) to try and solve this problem, but it has always felt clunky to me. Compare:f(g(h(x)))x.h.g.fx |> f |> g |> hI think most people prefer the second one to all the rest.
Pipeline operator ( |> ) in functional programming languages (Elixir, F#, Elm)
There is a proposal to add the pipeline operator |> to the standard that works similar to what you have here.https://github.com/tc39/proposal-pipeline-operator
If you're compiling to javascript anyway, why would you need a pipe operator in javascript instead of just nesting the function calls?
Looks like there’s a recent proposal for them:https://github.com/TheNavigateur/proposal-pipeline-operator-...
Isn't that what the pipe operator is for?
I miss the F# pipe operator (https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...) in other languages. It's so natural to think of function transform pipelines. In other languages you have to keep going to the left and prepend function names, and to the right to add additional args, parens etc ..
If you would call it pipe operator, like it's called in many (Elm, Elixir, F#, OCaml) other languages that have it, people would understand you faster IMHO. It is even discussed for inclusion into JavaScript.
Thanks for that link! Now I want pipe operators...
Elixir has the pipe notation, which is somewhat similar