Solution: Hot and Cold Data Sources
See the solution to the challenge presented previously.
We'll cover the following...
Solution
The solution to the challenge we just solved is as follows.
fun m(i: Int): Int { println("map$i ") return i * i * i } fun f(i: Int): Boolean { println("find$i ") return i >= 20 } fun main() { sequenceOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .map { m(it) } .find { f(it) } .let { print(it) } }
Complete solution to the challenge
Here is a line–by–line explanation of the code above:
-
Line 1: Create a function
m
which takes a valuei
of type ...