Skip to content

Instantly share code, notes, and snippets.

@javascripter
Created March 6, 2010 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javascripter/323497 to your computer and use it in GitHub Desktop.
Save javascripter/323497 to your computer and use it in GitHub Desktop.
Function.prototype.curried = function (that) {
var f = this, value;
var T = function () {
value = f.apply(that, arguments);
return T;
};
T.valueOf = function () {
return value;
};
return T;
};
alert(Math.max.curried()(1)(2,3)(4)+1) // 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment