Hi anyone who would know ? I'm trying to do a flow...
# coroutines
j
Hi anyone who would know ? I'm trying to do a flow of ints and trying to detect if the sequence is increasing or decreasing based on last 2 numbers...
so doing like
Copy code
val flow = MutableSharedFlow<Int>()
flow.tryEmit(1)
flow.tryEmit(2)
flow.tryEmit(3)
and was hoping to do something like following, but that doesn't worj
Copy code
flow
.zip(flow.drop(1)) { x, y -> y - x}
.collect { incOrDec ->
	println(incOrDec)
}
c
There's an implementation of
zipWithNext
in the comments of this issue: https://github.com/Kotlin/kotlinx.coroutines/issues/1767
👍 1