Created
May 23, 2014 12:15
-
-
Save lukewilde/41adcee9aca45152bf0d to your computer and use it in GitHub Desktop.
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 Y(le) { | |
return (function (f) { | |
return f(f); | |
}(function (f) { | |
return le(function (x) { | |
return f(f)(x); | |
}); | |
})); | |
} | |
var factorial = Y(function (fac) { | |
return function (n) { | |
return n <= 2 ? n : n * fac(n - 1); | |
}; | |
}); | |
var number120 = factorial(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment