Summary
We had a whirlwind tour of traversals in this chapter. We looked at functional combinators and how looping is way different from the traditional Java for loop. We also played with many examples of map, flatMap, filter, reduce, zip, and fold.
Scala for comprehension is a syntactic sugar that hides the complexity arising out of combining combinators. A running validation example delved into the nitty-gritty of the de-sugaring of the for comprehension.
This know-how prepared us to better appreciate flatMap, the glue that binds a pipeline of computations, aka the monad pattern. We saw how the for comprehension realizes monad and what happens behind the scenes. In addition, we had a detailed look at the reduce combinator and its left and right ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access