Last active
January 3, 2016 07:19
-
-
Save mfbx9da4/8428983 to your computer and use it in GitHub Desktop.
A contrived example of some functional techniques.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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