var args = [].slice.call(arguments, 1);
return fn.apply(this, args.concat([].slice.call(arguments)));
function curry(fn, length) {
length = length || fn.length;
var slice = Array.prototype.slice;
if (arguments.length < length) {
var combined = [fn].concat(slice.call(arguments));
return curry(sub_curry.apply(this, combined), length - arguments.length);
return fn.apply(this, arguments);
var fn = curry(function(a, b, c) {
fn("a", "b", "c") // ["a", "b", "c"]
fn("a", "b")("c") // ["a", "b", "c"]
fn("a")("b")("c") // ["a", "b", "c"]
fn("a")("b", "c") // ["a", "b", "c"]