Last active
August 29, 2015 14:01
-
-
Save yukitos/f6dfccf18b087860da4a to your computer and use it in GitHub Desktop.
Make seven, times and five functions where seven(times(five())) == 35.
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
function makeNum(n, f) { | |
if (f == null) { return n; } | |
else { return f(n); } | |
} | |
function five(f) { | |
return makeNum(5, f); | |
} | |
function seven(f) { | |
return makeNum(7, f); | |
} | |
function times(v) { | |
return function(u) { return v * u; }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment