Skip to content

Instantly share code, notes, and snippets.

@remydagostino
Created June 8, 2014 14:55
Show Gist options
  • Save remydagostino/607289c968f916b2e7d8 to your computer and use it in GitHub Desktop.
Save remydagostino/607289c968f916b2e7d8 to your computer and use it in GitHub Desktop.
Tiny Autocurry
// curry :: ((a, b) -> c) -> a -> b -> c
function curry(fn) {
return function() {
if (arguments.length < fn.length) {
return curry(fn.bind.apply(fn, [this].concat(Array.prototype.slice.call(arguments))));
}
else {
return fn.apply(this, arguments);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment