title: Folding a list of tuples using Scala
body: <p>What's wrong with this simple scala code?</p>
  
  <pre><code>val l = List(("a", 1), ("b", 2), ("c", 3), ("d", 4), ("e", 5))
  l.fold(0) {(acc: Int, tup: (String, Int)) =&gt; acc + tup._2}
  </code></pre>
  
  <blockquote>
    <p>:9: error: type mismatch;
     found   : (Int, (String, Int)) => Int
     required: (Any, Any) => Any
                  l.fold(0) {(acc: Int, tup: (String, Int)) => acc + tup._2}</p>
  </blockquote>
  
  <p>In other functional languages (e.g., f#) this works:</p>
  
  <pre><code>let l = [("a", 1); ("b", 2); ("c", 3); ("d", 4)];;
  List.fold(fun accm tup -&gt; accm + (snd tup)) 0 l;;
  val it : int = 10
  </code></pre>