Created
January 28, 2012 08:56
-
-
Save mduvall/1693584 to your computer and use it in GitHub Desktop.
partial application in js
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 currying | |
function curry(fn) { | |
var s = Array.prototype.slice; | |
var vargs = s.call(arguments, 1); | |
return function() { | |
var nargs = s.call(arguments); | |
var args = vargs.concat(nargs); | |
return fn.apply(null, args); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment