Created
August 30, 2010 06:55
-
-
Save clairvy/557111 to your computer and use it in GitHub Desktop.
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
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