title: Scala conditional sum of elements in a filtered tuples list
body: <p>I'm new to Scala and need a little help about how to combine
  filters and sum on a list of tuples. </p>
  
  <p>What I need is the sum of integers of a filtered tuples list which
  essentially the answer to the question:</p>
  
  <p>What is the sum of all set weights?  </p>
  
  <p>The result should be 20 for the sample list below</p>
  
  <p>The list is pretty simple:</p>
  
  <pre><code>     val ln = List( ("durationWeight" , true, 10),
                      ("seasonWeight"   , true, 10),
                      ("regionWeight"   , false, 5),
                       ("otherWeight"   , false, 5)
  </code></pre>
  
  <p>Filtering the list according to the Boolean flag is a simple:</p>
  
  <pre><code>     val filtered = ln.filter { case(name, check, value) =&gt; check == true  }
  </code></pre>
  
  <p>which returns me the wanted tuples. Getting the sum of all them seems to work 
  with a map followed by sum:</p>
  
  <pre><code>  val b = filtered.map{case((name, check, value) ) =&gt; value}.sum
  </code></pre>
  
  <p>Which returns me the wanted sum of all set weights. </p>
  
  <p>However, how do I do all that in one step combining filter, map and sum, 
  ideally in an elegant one liner?</p>
  
  <p>Thanks for your help.</p>