Skip to content

Instantly share code, notes, and snippets.

@tomasherman
Created July 2, 2012 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomasherman/3032022 to your computer and use it in GitHub Desktop.
Save tomasherman/3032022 to your computer and use it in GitHub Desktop.
//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