Created
July 17, 2013 06:31
-
-
Save davidjbeveridge/6018118 to your computer and use it in GitHub Desktop.
More stable currying w/ variable args
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
curry = (fn, args...) -> | |
old_args = args.slice() | |
currier = (x...) -> | |
if arguments.length is 0 | |
val = fn(args...) | |
args = old_args | |
val | |
else | |
args = [args..., x...] | |
currier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment