Skip to content

Instantly share code, notes, and snippets.

@olecksamdr
Created March 29, 2019 11:54
Show Gist options
  • Save olecksamdr/b81d1e1dda60f06d58d9276ee54e9592 to your computer and use it in GitHub Desktop.
Save olecksamdr/b81d1e1dda60f06d58d9276ee54e9592 to your computer and use it in GitHub Desktop.
// 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