Skip to content

Instantly share code, notes, and snippets.

@peterschussheim
Last active April 10, 2019 00:08
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 peterschussheim/c6c86ca6c7f73178b62b5fac00e90fb7 to your computer and use it in GitHub Desktop.
Save peterschussheim/c6c86ca6c7f73178b62b5fac00e90fb7 to your computer and use it in GitHub Desktop.
curry

currying

When a function that accepts n arguments continues to return a new function if it hasn't yet received all args it needs.

Manual PA

numbers.map(num => add(2, num))

OR

numbers.map(add.bind(null, 2))

Automatic PA

numbers.map(add(2)) -- With currying you effortlessly create specialized unary functions on the fly with very little code using a “point-free” style.

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