const compose = (...funcs) => args => funcs.reduceRight((arg, fn) => fn(arg), args);
// Or if you like in ES5
function compose(...funcs)
{
return function(args)
{
return funcs.reduceRight( (arg, fn) => fn(arg), args);
}
}
const compose = (...fns) => x0 => fns.reduceRight(
(x, f) => f(x),
x0
);