Created
September 18, 2011 22:12
-
-
Save autotelicum/1225615 to your computer and use it in GitHub Desktop.
Y-combinator in CoffeeScript
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
show = console.log | |
Y = (f) -> ((g) -> g g) (h) -> (args...) -> f(h(h)) args... | |
factorial = Y (recurse) -> (x) -> if x is 0 then 1 else x * recurse x-1 | |
show factorial 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have lost track of the article describing this technique. The Y-combinator is not practical or useful. Posted because I was testing my gist mechanism from acme via Inferno to Mac OS X to github. Now it works.