Created
January 5, 2017 07:27
-
-
Save lancetw/312aeaabe1e2c1082c8a2f5bf5f97395 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var fact = (function (fact) { | |
return (function (f) { | |
return f(function (f) { | |
return fact(function (n) { | |
return f(f)(n) | |
}) | |
}) | |
})(function (f) { | |
return f(f) | |
}) | |
})(function (f) { | |
return function (n) { | |
return n == 0 ? 1 : n * f(n - 1) | |
} | |
}) | |
console.log(fact(5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment