title: Scala: map function not returning desired result
body: <p>I am coding a scala function that has to return a <code>List[TaskSchedule]</code>.</p>
  
  <p>If I do it like this, it returns the desired type:</p>
  
  <pre><code>val taskSchedules = orders.flatMap { order =&gt; createSchedules(order, order.prod.tasks) }
  </code></pre>
  
  <p>The thing is that I want to run <code>createSchedules</code> n times, so I did this:</p>
  
  <pre><code>val taskSchedules = orders.map { order =&gt; (1 to order.quantity) foreach ( _ =&gt; createSchedules(order, order.prod.tasks) )}
  </code></pre>
  
  <p>But this way, taskSchedules are from type <code>List[Unit]</code></p>
  
  <p>What am I doing wrong here?</p>