Created
July 2, 2012 08:42
-
-
Save tomasherman/3032022 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
//E 3.3.4 | |
def init[A](l: List[A]): List[A] = { | |
l match { | |
case Nil => Nil | |
case Cons(x,Nil) => Nil | |
case Cons(x,xs) => Cons(x,init(xs)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment