|
|
|
|
|
by marcmarc
6185 days ago
|
|
Here's my take: function curry(fn, args) {
if (typeof args == "undefined" || args.length < fn.length)
return function() {
if (typeof args == "undefined")
args = [];
return curry(fn, args.concat(Array.prototype.slice.call(arguments)));
};
return fn.apply(this, args);
}
var add = curry(function(a, b, c) { return a + b + c;});
|
|