Last active
May 30, 2017 12:22
-
-
Save john-e/da34aa20223d83fb2caa9a062c6802b2 to your computer and use it in GitHub Desktop.
Trying out curry function in javascript
This file contains hidden or 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 curry (fn, ...args) { | |
| if (fn.length == args.length) return fn(...args); | |
| return (...args2) => { | |
| return curry(fn, ...[...args, ...args2]); | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment