Skip to content

Instantly share code, notes, and snippets.

@clairvy
Created August 30, 2010 06:55
Show Gist options
  • Save clairvy/557111 to your computer and use it in GitHub Desktop.
Save clairvy/557111 to your computer and use it in GitHub Desktop.
object Main extends Application {
println("zero: " + zero(0)(i => i +1))
println("one: " + succ[Int](zero)(0)(i => i + 1))
def zero[A](i : A) = (f : A => A) => i
def succ[A](n : A=>(A=>A)=>A) = (i:A)=>(f:A=>A)=>f(n(i)(f))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment