title: In Scala, how do I fold a List and return the intermediate results?
body: <p>I've got a List of days in the month:</p>
  
  <pre><code>val days = List(31, 28, 31, ...)
  </code></pre>
  
  <p>I need to return a List with the cumulative sum of days:</p>
  
  <pre><code>val cumDays = List(31, 59, 90)
  </code></pre>
  
  <p>I've thought of using the fold operator:</p>
  
  <pre><code>(0 /: days)(_ + _)
  </code></pre>
  
  <p>but this will only return the final result (365), whereas I need the list of intermediate results.</p>
  
  <p>Anyway I can do that elegantly?</p>