Skip to content

Instantly share code, notes, and snippets.

@jtrupiano
Created April 20, 2009 23:22
Show Gist options
  • Save jtrupiano/98838 to your computer and use it in GitHub Desktop.
Save jtrupiano/98838 to your computer and use it in GitHub Desktop.
def length(lst: List[Int]): Int = {
lst match {
case Nil => 0
case head :: tail => 1 + length(tail)
}
}
length(List(1, 1, 2, 3, 5, 8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment