Skip to content

Instantly share code, notes, and snippets.

@artemtr
Created July 24, 2023 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artemtr/acb9cafe88a9105ecda44846a3fe4a49 to your computer and use it in GitHub Desktop.
Save artemtr/acb9cafe88a9105ecda44846a3fe4a49 to your computer and use it in GitHub Desktop.
Curry
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