Hacker News new | ask | show | jobs
by aloisdg 1916 days ago
because a -> f -> g -> h is better than h(g(f(a))). It is the functional way of doing the OOP fluent builder pattern: a.f().g().h()

It is the pipe operator (F#, Elixir, Haxe, etc.). There is a proposal to add it to js too.

2 comments

On top of that, it is a symmetrical to fat arrow functions, which is a shorthand for lambda:

fun: x => x * 2

res: 4 -> fun

I have always used ramdajs for this.

const R = require('ramda');

R.pipe(a,f,g,h)