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 ...
Get Scala Functional Programming Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.