Summary
In this chapter, you learned about functions. We talked about Scala functions that are first-class values. This means that we can pass them as arguments and return them as values. You learned about variable scopes and bindings and an important concept called closure. We looked at some amazing uses for the underscore, which is termed as Scala's Swiss army knife. Armed with the know-how of local functions, closures, and scope, we looked at partially applied functions and currying. We also saw how currying and partially applied forms are compared with each other.
These are very useful techniques as illustrated by the loan pattern. This is a resource lifecycle pattern similar to the RAII idiom in C++. Next, we looked at the template method design pattern, its applicability, and the Java version. The Scala version is short and sweet, thanks to the partially applied functions.
In the last chapter, we looked at the decorator design pattern, and how Scala's stackable modifications...