Skip to content

Instantly share code, notes, and snippets.

@andiwinata
Created April 1, 2019 10:09
Show Gist options
  • Save andiwinata/6a873f3398944c51d389c5db1fc8a93b to your computer and use it in GitHub Desktop.
Save andiwinata/6a873f3398944c51d389c5db1fc8a93b to your computer and use it in GitHub Desktop.
Implementation of curry is es6
// Curry is only taking 1 parameter different from partial application
curry = fn => {
const self = params => arg => {
const nextParams = [...params, arg]
if (nextParams.length === fn.length) return fn(...nextParams);
return self(nextParams);
}
return self([])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment