-
Book Overview & Buying
-
Table Of Contents
Scala Functional Programming Patterns
By :
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 variants. A peek behind the curtain showed us the differences between reduceLeft and reduceRight.
This is the functional style where we could compose pure functions and reason better and at a higher level of abstraction. Pure functions and combinators...
Change the font size
Change margin width
Change background colour