Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created May 7, 2010 12:33
Show Gist options
  • Save kmizu/393363 to your computer and use it in GitHub Desktop.
Save kmizu/393363 to your computer and use it in GitHub Desktop.
object F {
class Link(f: () => Link) extends (() => Link) {
def apply(): Link = f()
}
def f(): Link = {
def n(x: Int): Link = {
println(x)
new Link(() => n(x + 1))
}
n(0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment