Created
April 20, 2009 23:22
-
-
Save jtrupiano/98838 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
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