This is the official forum for our book, Reactive Programming with Kotlin, available here: https://store.raywenderlich.com/products/reactive-programming-with-kotlin
Hi. When will be released the updated version of the book? Thanks
I have a question on the solution given for the challenge in chapter 9. The code given is
val observable = source.scan(0 to 0) { acc, current ->
current to acc.second + current
}
The type of source
is Observable<Int>
.
The type of the initial value passed to scan is Pair<Int, Int>
.
The type of scan
’s first argument is BiFunction<T, T, T>
(T
being Int
in this case)
So I’m surprised that this actually compiles, because the type of the initial value differs from the type of the observable’s items. Now that I’m asking, I realise the Pair is probably being implicitly destructured . Is that correct?