Currying: Difference between revisions
→Simple 2 and N argument versions
(→JS ES6: Simple 2 argument, and arbitrary argument, currying) |
|||
Line 740:
Or, recursively currying functions of arbitrary arity:
<lang JavaScript>(
// (arbitrary arity to fully curried)
// extraCurry :: Function -> Function
let extraCurry =
// Recursive currying
let _curry = (xs, ...arguments) =>
f.apply(null, xs)
) : function () {
return _curry(xs.concat([].slice.apply(arguments)));
};
return _curry([].slice.call(args, 1));
|