Created
July 13, 2014 03:43
-
-
Save kongtomorrow/b2c13644b772c371d72e to your computer and use it in GitHub Desktop.
looping ω combinator
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
// trying to implement http://math.stackexchange.com/questions/96122/looping-ω-combinator | |
// want ω: ω ↦ ω(ω) | |
class SelfToSelf { | |
let value:SelfToSelf->SelfToSelf | |
init(value:SelfToSelf->SelfToSelf) { | |
self.value = value | |
} | |
} | |
func ω(f:SelfToSelf)->SelfToSelf { | |
return f.value(f) | |
} | |
ω(SelfToSelf(value:ω)) // infinite loop (intentionally). doesn't crash when compiled release. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment