title: Converting nested for loops into for comprehension
body: <p>I can collect the results at the inner-most <code>for</code> body into a <code>List[Output]</code> and return them. But I want to use <code>yield</code>. How can this method be converted into using <code>for-yield</code> pattern:</p>
  
  <pre><code>def useForComprehension(input : Input): List[Output] = {        
    for (o &lt;- splitInputIntoPieces(input)) {
      for (restResults &lt;- useForComprehension(subtract(input, o)) ) {
          for (w &lt;- f3(o)) {
            yield w::restResults // !!!!! Error
          }
      }           
    }    
  }
  </code></pre>