Skip to content

Instantly share code, notes, and snippets.

@pre1ude
Created October 5, 2018 15:34
Show Gist options
  • Save pre1ude/59665508925c959c9fc94ce8de1a8ca3 to your computer and use it in GitHub Desktop.
Save pre1ude/59665508925c959c9fc94ce8de1a8ca3 to your computer and use it in GitHub Desktop.
just as named
const curry = f => (...args) =>
args.length < f.length
? curry(f.bind(undefined, ...args))
: f(...args)
// : f(...args.slice(0, f.length))
const add = (a, b, c) => a + b + c
const cAdd = curry(add)
cAdd(1,2,3)//6
cAdd(1)(2,3)//6
cAdd(1)(2)(3)//6
cAdd(1,2)(3)//6
@pre1ude
Copy link
Author

pre1ude commented Oct 5, 2018

carbon

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