Skip to content

Instantly share code, notes, and snippets.

@griesmey
Created October 12, 2016 16:09
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 griesmey/9f675a115e42e2ea1b60acf0bf14d727 to your computer and use it in GitHub Desktop.
Save griesmey/9f675a115e42e2ea1b60acf0bf14d727 to your computer and use it in GitHub Desktop.
def squareList(xs: List[Int]): List[Int] = xs match {
case Nil => xs
case y :: ys => y * y :: squareList(ys)
}
def squareList1(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