Possible Duplicate:
In Scala, how do I fold a List and return the intermediate results?
I am searching for a functional way of accumulating the elements of a SortedTree in the following way:
I want a list with containing the sums of all precursors (including the element itself) for all elements in the SortedTree.
For Exmaple:
SortedTree contains (0.4, 0.3, 0.2, 0.1, 0.05)
I want the list: (0,4. 0.7, 0. 9, 1, 1.05)
Any suggestions?