Created
May 16, 2010 14:59
-
-
Save arch-jslin/402915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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