Skip to content

Instantly share code, notes, and snippets.

@matt-mcmahon
Created June 13, 2017 12:01
Show Gist options
  • Save matt-mcmahon/e132bee55381cbeaa4de13e27fefdee1 to your computer and use it in GitHub Desktop.
Save matt-mcmahon/e132bee55381cbeaa4de13e27fefdee1 to your computer and use it in GitHub Desktop.
// Auto Curry "Magic Spell", by Eric Elliott
// https://medium.com/javascript-scene/a-functional-programmers-introduction-to-javascript-composing-software-d670d14ede30
const curry = (
f, arr = []
) => (...args) => (
a => a.length === f.length ?
f(...a) :
curry(f, a)
)([...arr, ...args]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment