Created
          November 3, 2010 16:25 
        
      - 
      
- 
        Save daithiocrualaoich/661305 to your computer and use it in GitHub Desktop. 
    Anonymous functions with tuple parameters
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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