Skip to content

Instantly share code, notes, and snippets.

@arch-jslin
Created May 16, 2010 14:59
Show Gist options
  • Save arch-jslin/402915 to your computer and use it in GitHub Desktop.
Save arch-jslin/402915 to your computer and use it in GitHub Desktop.
Function.method('curry', function(){
var slice = Array.prototype.slice,
args = slice.apply(arguments),
that = this;
return function(){
var complete_pack = args.concat(slice.apply(arguments));
if( complete_pack.length < that.arity ) {
return that.curry.apply(that, complete_pack);
}
else return that.apply(null, complete_pack);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment