Created
March 29, 2019 11:54
-
-
Save olecksamdr/b81d1e1dda60f06d58d9276ee54e9592 to your computer and use it in GitHub Desktop.
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
// curry :: ((a, b, ...) -> c) -> a -> b -> ... -> c | |
function curry(fn) { | |
const arity = fn.length; | |
return function $curry(...args) { | |
if (args.length < arity) { | |
return $curry.bind(null, ...args); | |
} | |
return fn.call(null, ...args); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment