Created
October 3, 2012 05:04
-
-
Save dyoder/3825117 to your computer and use it in GitHub Desktop.
CoffeeScript is good at lambda calculus
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
# λf.(λg.f (g g)) (λg.f (g g)) | |
Y = (f) -> ((g) -> f((x) -> g(g)(x)))((g) -> f((x) -> g(g)(x))) | |
# ß-reduction of Y: λf.(λg.g g) (λg.f (g g)) | |
X = (f) -> ((g) -> g((x) -> g(x)))((g) -> f((x) -> g(g)(x))) | |
# applied to factorial ... this returns 720 | |
X((f) -> (x) -> if x is 1 then 1 else x * f(x - 1))(6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As an aside, I'd love to better understand the semantics of:
λg.f h
That is, why does it mean this: