ES7 Proposal: The Pipeline Operator
github.com
ES7 Proposal: The Pipeline Operator
1–10 of 78 posts
Re: ES7 Proposal: The Pipeline Operator
#2Especially that it worked in both directions.
my-list = filter Re: ES7 Proposal: The Pipeline Operator
#3Re: ES7 Proposal: The Pipeline Operator
#4There's a lot more operators than |> that you would want. Clojure commonly uses ->, ->>, as->, etc. It should be done in a library if it is done at all.
Also, going full-on functional in javascript is going to end badly, javascript simply wasn't designed for it. If you go down this path in real projects, sooner or later you inevitably end up at clojurescript or whatever other real FP language suits.
Re: ES7 Proposal: The Pipeline Operator
#5 function bindMap(fn) { return this.map(fn) }
[ 1, 2, 3 ]::bindMap(n => n + 1)
// standalone use: bindMap.call(arr, fn)
function pipelineMap(fn) { return arr => arr.map(fn) }
[ 1, 2, 3 ] |> pipelineMap(n => n + 1)
// standalone use: pipelineMap(fn)(arr)
(Also nice that it works in a very similar way to decorators, although they won't be interchangeable in most cases, with decorators working on class constructors and property descriptors, instead of just any value.)Presumably, at most one of these proposals will make it in :)
Re: ES7 Proposal: The Pipeline Operator
#6Re: ES7 Proposal: The Pipeline Operator
#7Re: ES7 Proposal: The Pipeline Operator
#8Re: ES7 Proposal: The Pipeline Operator
#9Javascript's beauty lies in its versatile simplicity. Can we just leave these sorts of things to systems programming languages like C++? I came to javascript because of its lack of cruft, but if libraries start adopting this then I'll be forced to put it in my code as well. If that happens then I'll probably leave for nim or clojure, though that's not preferable.