KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've got a List of days in the month: val days = List(31, 28, 31, ...) I need to return a List with the cumulative sum of days: val cumDays = List(31, 59, 90) I've thought of using the fold operator: (0 /: days)(_ + _) but this will only return the final result (365), whereas I need the list of intermediate results. Anyway I can do that elegantly?
Tags (comma-separated)
Save Edits
Cancel