Skip to content

Instantly share code, notes, and snippets.

@SimonRichardson
Created November 11, 2013 15:38
Show Gist options
  • Select an option

  • Save SimonRichardson/7415122 to your computer and use it in GitHub Desktop.

Select an option

Save SimonRichardson/7415122 to your computer and use it in GitHub Desktop.
Why does javascript throw this error - REALLY! Why do we have to have work arounds for native partial applications in javascript. It's bad from a developer point of view that we have to increase boiler plate for functions that should be callable but isn't! Could this be solved by the fat arrow, where the scope is defined already in the function …
function apply(f) {
return function(x) {
return f(x);
};
}
apply(console.log)(2);
// Using fat arrow.
function apply(f) {
return (x) => f(x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment