title: Have yield ignore () values ("flat yield")
body: <p>I have a map and I want to transform it, via yield, to a new collection, filtering based on the keys. I only want a subset of the map entries to be in the new collection. </p>
  
  <pre><code>scala&gt; val the_map = Map(1-&gt;10, 2-&gt;41, 3-&gt;41, 27-&gt;614, 400-&gt;541, 5214 -&gt; 2)
  the_map: scala.collection.immutable.Map[Int,Int] = Map(1 -&gt; 10, 2 -&gt; 41, 27 -&gt; 614, 3 -&gt; 41, 400 -&gt; 541)
  
  scala&gt; val transformed = for ((k, v) &lt;- the_map) yield {if (k &lt; 10) { v * 10 } else if (k &gt; 100 &amp;&amp; k &lt; 400) { v * 5 }}
  transformed: scala.collection.immutable.Iterable[AnyVal] = List(100, 410, (), 410, 2705, ())
  </code></pre>
  
  <p>So I basically want that, but without the ()s in there, and the type to be Iterable[Int]. What's the right approach here? I could filter to remove the ()s and then cast, but that seems wrong. I could Some all the values and put a None at the bottom, and then call flatten, but that seems excessive. Is there a clean way to go? I just want yield to ignore the ()'s that are returned when no if statement matches.</p>