title: Different ways of calling map function in scala
body: <p>My function is</p>
  
  <pre><code>val f2 : (String, String) =&gt; Int = new Function2[String, String, Int] {
    def apply(s1 : String, s2 : String) = s1.length + s2.length
  }
  </code></pre>
  
  <p>Why cannot I do this in Scala</p>
  
  <pre><code>val listOfFullNames = List(("Mark","Smith"), ("Jim","Duggan"), ("Eddie","Murphy"), ("Sylvester","Stallone"))
  
  val output3 = listOfFullNames.map(f2)
  </code></pre>
  
  <p>The error message is interesting, it says expected: (String, String) => TypeInferredB, but actual (String, String) => Int</p>
  
  <pre><code>//But this works fine
  val output3 = listOfFullNames.map(x =&gt; f2(x._1, x._2))
  </code></pre>
  
  <p>The reason I am doing this is purely because, this works</p>
  
  <pre><code>val f :String =&gt; Int = new Function[String, Int] {
    def apply(s : String) = s.length
  }
  </code></pre>
  
  <p>this can be used like this</p>
  
  <pre><code>val listOfNames = List("Mark", "Jim", "Eddie", "Sylvester","Stallone")
  
  val output = listOfNames.map(f)
  </code></pre>
  
  <p>Just want to know the difference between the following usages.</p>
  
  <pre><code>list.map(_.lowercase)
  
  list.map(f)
  
  listOfFullNames.map(x =&gt; f2(x._1, x._2))
  </code></pre>