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

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.