Skip to content

Instantly share code, notes, and snippets.

@chee
Last active September 14, 2018 15:17
Show Gist options
  • Select an option

  • Save chee/6d34d54d5aa2f3463c5b2730e7c8e89f to your computer and use it in GitHub Desktop.

Select an option

Save chee/6d34d54d5aa2f3463c5b2730e7c8e89f to your computer and use it in GitHub Desktop.
curry
l='length';c=f=>function c(...a){return a[l]>=f[l]?f(...a):(...n)=>c(...a,...n)}
const curry = fn => function c(...args) {
return args.length >= fn.length ? fn(...args) : (...next) => c(...args, ...next)
}
@chee
Copy link
Author

chee commented Sep 14, 2018

c=f=>function c(...a){return a[l='length']>=f[l]?f(...a):(...n)=>c(...a,...n)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment