In this chapter, we looked at higher order functions, namely functions that take other functions as parameters, return a function as a result, or both.
We looked at the strategy pattern's Java implementation. We used Scala's higher order functions instead, to implement the algorithm encapsulation. Instead of Java classes implementing an interface, we passed in function literals. Then, we looked at three important patterns related to higher order functions.
We looked at Functors and then at the collection's map method. The second pattern was a Monad. We also looked at the
flatMap method. The third pattern was monoids. In a related context, we also looked at
We applied the know-how to write an inverted index program. We looked at ...