Last active
August 29, 2015 14:17
-
-
Save Hirurg103/8ce270d406765db2ad18 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
curryN = (f, n) -> | |
if n <=1 | |
f | |
else | |
(firstArg) -> | |
curryN( | |
-> | |
f.apply null, [firstArg].concat Array.prototype.slice.call(arguments), | |
n-1 | |
) | |
curry = (f)-> | |
curryN(f, f.length) | |
f = (a, b, c, d, e) -> a.toString() + " + " + b.toString() + " + " + c.toString() + " + " + d.toString() + " + " + e.toString() | |
curryF = curry f | |
alert curryF(1)(1)(2)(10)(12) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment