Remix.run Logo
▲ kiicia 3 hours ago

you can start with

    var chain = x=>f=>f?chain(f(x)):x;
    chain(x)(h)(g)(f)();
if you need to partly curry to free first argument

    var _ = (f,...y)=>x=>f(x,...y);
    var sum = (x,y)=>x+y;
    chain(1)(_(sum,1))()
if you want whole pipeline

    var $ = (x,...f)=>f.reduce((x,f)=>f(x),x);
    $(1,_(sum,1));
which gives fun ability to extract function without input param

    var sum1 = _($,_(sum,1));
    sum1(1);
... which in turn is just having fun with point-free JS