Skip to content

Instantly share code, notes, and snippets.

@bmarcot
Created April 26, 2013 09:50
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 bmarcot/5466163 to your computer and use it in GitHub Desktop.
Save bmarcot/5466163 to your computer and use it in GitHub Desktop.
def squareList(xs: List[Int]): List[Int] = xs match {
case Nil => Nil
case y :: ys => y * y :: squareList(ys)
}
def squareList(xs: List[Int]): List[Int] = xs map (y => y * y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment