Skip to content

Instantly share code, notes, and snippets.

@kongtomorrow
Created July 13, 2014 03:43
Show Gist options
  • Save kongtomorrow/b2c13644b772c371d72e to your computer and use it in GitHub Desktop.
Save kongtomorrow/b2c13644b772c371d72e to your computer and use it in GitHub Desktop.
looping ω combinator
// 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