ubu
11/01/2019, 11:56 PMFlow
emitting 1
, 2
, 3
. Is there a way to transform this flow to emit: [1]
, [1,2]
, [1,2,3]
. I know there’s this fold
operator, but it’s terminal. In my case I need a value to be emitted on each accumulation step. Is there any appropriate operator out-of-the-box?octylFractal
11/02/2019, 12:00 AMtransform
scan
operator is close to what you want, but it would include an empty list due to its designscan(...).skip(1)
Zach Klippenstein (he/him) [MOD]
11/02/2019, 12:01 AMflow.scan(emptyList<Int>()) { list, value -> list + value }
.drop(1)
octylFractal
11/02/2019, 12:01 AMubu
11/02/2019, 12:03 AM