Currying: Difference between revisions

(→‎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 = (f, ...args) => {
 
// Recursive currying
let _curry = (xs, ...arguments) => {
return xs.length >= f.length ? (
f.apply(null, xs)
) : function () {
return _curry(xs.concat([].slice.apply(arguments)));
};
};
 
return _curry([].slice.call(args, 1));
9,659

edits