title: Pattern matching on function parameters
body: <p>I have a vector of tuples </p>
  
  <pre><code>val l = for {i &lt;- 1 to 5} yield (i,i*2)
  Vector((1,2), (2,4), (3,6), (4,8), (5,10))
  </code></pre>
  
  <p>and I'd like to sum it in the following way:</p>
  
  <pre><code>l.reduce((x,y) =&gt; (x._1+y._1, x._2+y._2))
  (15,30)
  </code></pre>
  
  <p>but with use of pattern matching.</p>
  
  <p>I know how to do it if the function gets only one parameter, ie: <code>l.map({case(a,b)=&gt;a+b})</code>, but I can't get it to work with two parameters. this is what I tried to do:</p>
  
  <pre><code>l.reduce({(case(a,b),case(c,d))=&gt;(a+c,b+d)})
  </code></pre>
  
  <p>but that won't work.</p>
  
  <p>So my question is, how can I unpack 2 tuples that come as a function parameters?</p>