Skip to content

Instantly share code, notes, and snippets.

@mfbx9da4
Last active January 3, 2016 07:19
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 mfbx9da4/8428983 to your computer and use it in GitHub Desktop.
Save mfbx9da4/8428983 to your computer and use it in GitHub Desktop.
A contrived example of some functional techniques.
first = function (a) {
return function (b) {
return function (c) {
if (c < 4) {
return c * (b + a);
} else {
return ((first(a))(b))(c-1);
}
}
}
}
n = 4
second = first(n);
third = second(n * 2);
answer = third(n * 3)
console.log(answer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment