Skip to content

Instantly share code, notes, and snippets.

@daithiocrualaoich
Created November 3, 2010 16:25
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 daithiocrualaoich/661305 to your computer and use it in GitHub Desktop.
Save daithiocrualaoich/661305 to your computer and use it in GitHub Desktop.
Anonymous functions with tuple parameters
scala> val l = List((1,2), (2,3))
l: List[(Int, Int)] = List((1,2), (2,3))
scala> l map { case (i, j) => i+j }
res5: List[Int] = List(3, 5)
scala> import Function.tupled
import Function.tupled
scala> l map tupled { (i, j) => i + j }
res6: List[Int] = List(3, 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment