Skip to content

Instantly share code, notes, and snippets.

@yukitos
Last active August 29, 2015 14:01
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 yukitos/f6dfccf18b087860da4a to your computer and use it in GitHub Desktop.
Save yukitos/f6dfccf18b087860da4a to your computer and use it in GitHub Desktop.
Make seven, times and five functions where seven(times(five())) == 35.
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