Skip to content

Instantly share code, notes, and snippets.

@oosby
Last active August 29, 2015 14:22
Show Gist options
  • Save oosby/18f7a939f9fe25b03e71 to your computer and use it in GitHub Desktop.
Save oosby/18f7a939f9fe25b03e71 to your computer and use it in GitHub Desktop.
Curry
function curryMe(x, y, z) {
return x / y * z;
};
function currier() {
var f = Array.prototype.shift.call(arguments);
var a = Array.prototype.slice.call(arguments);
function maker () {
var b = Array.prototype.slice.call(arguments),
c = a.concat(b);
console.log(c)
if (c.length === f.length) {
return f.apply(this, c);
} else {
a = c;
return maker;
}
}
return maker;
};
var sample = currier(curryMe, 2)(4)(3);
console.log(sample)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment