2 ms·
I used to think the same, until it was pointed out to me that the semantics have to be nailed down exactly, so that conforming implementations (e.g. Chrome/FF)
by andreareina 8y ago
I used to think the same, until it was pointed out to me that the semantics have to be nailed down exactly, so that conforming implementations (e.g. Chrome/FF) do the same thing. This includes figuring out how (if at all) it works with generators and async functions, if you want to support implicit lambdas, etc[1]. Clojure and ML (and related languages I imagine) have the advantages that it is expressible in code which at least makes the specification part simpler.
Fortunately the simple version is easily approximated, I have this sprinkled in various files where it's useful:
const pipeline = (val, ...funcs) => funcs.reduce((a, b) => b(a), val);
[1] https://babeljs.io/blog/2018/07/19/whats-happening-with-the-pipeline-proposal https://babeljs.io/blog/2018/07/19/whats-happening-with-the-...