-
-
Save elclanrs/95f0fbe365089259b232 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
var toArray = Array.call.bind([].slice) | |
var curryN = function(n, f, as) { | |
return function() { | |
var bs = (as||[]).concat(toArray(arguments)) | |
return bs.length < n ? curryN(n, f, bs) : f.apply(null, bs) | |
} | |
} | |
var curry = function(f) { | |
return function() { | |
var as = toArray(arguments) | |
return f.length > as.length ? curryN(f.length, f, as) : f.apply(null, as) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment