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

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

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