Here is a related thread on the topic: Does Kotlin have something similar to RxJava scan?
I know I have needed this functionality multiple times in the past and I know that rxjava has it as the scan function but do not remember the specific use cases I had. Here is an issue I opened on a Java streaming API to add similar operators, but it didn’t have significant use cases.
I know I needed something related to do a flow style layout where I have an iterable list of items that all had a width property and I wanted to group them into collections based on how they fit on lines. This is more complex case I know but does involve similar summing of cumulative items.
I disagree with others that say this should not be in the stdlib. It is like reduce except that instead of only giving you the result of all items it gives you the result on each item.