title: How to return multiple elements from collection?
body: <p>In the list I need to replace each element with the sum of this element and all previous ones. The first element is not required to change.
  Example: The list (1.0, 2.0, 3.0, 4.0) must be converted (1.0, 3.0, 6.0, 10.0). I'm looking for the most concise and correct way.</p>
  
  <p>I was googling for a long time and could not find any useful information regarding the conversion of an element by the sum of its previous ones. Also I could not find the required function in the standard library at Kotlinlang.org. Please help solve this problem.</p>
  
  <pre><code>fun accumulate(list: MutableList&lt;Double&gt;): MutableList&lt;Double&gt; {
      if (list.isEmpty()) return list
      else for (i in 0 until list.size) {
          if (i == list.indexOf(list.first())) list[i] = list.first()
          else list[i] = list.sumByDouble { it } // here's my problem
      }
      return list
  }
  </code></pre>