O'Reilly logo

Scala Functional Programming Patterns by Atul S. Khot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required