Created
July 24, 2023 16:36
-
-
Save artemtr/acb9cafe88a9105ecda44846a3fe4a49 to your computer and use it in GitHub Desktop.
Curry
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
const curry = | |
(fn) => | |
(...arg) => { | |
if (fn.length > arg.length) { | |
console.log(fn.length); | |
const f = fn.bind(null, ...arg); | |
return curry(f); | |
} else { | |
console.log(fn.length, arg.length); | |
return fn(...arg); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment