Book Image

Scala Intermediate Recipes [Video]

By : Antonio Salazar Cardozo
Book Image

Scala Intermediate Recipes [Video]

By: Antonio Salazar Cardozo

Overview of this book

Now that we have the easy stuff out of the way, we take delve into some of Scala's more powerful features. Pattern matching is Scala's tremendous ability to deconstruct data in intuitive and readable ways, letting you write safely in a few lines of code what other languages can take tens of buggy lines to get across. We'll explore the various ways that patterns can be used, as well as some of the more advanced functionality that they hide. A quick detour into testing will introduce the specs2 library and how to use it to do behavior-driven development in Scala. Then we'll dig into Scala's collections some more; Scala's collections library is vast, and holds many powerful tools for dealing with data. Finally, we'll go through a few tricks that let you get readable and type-safe frameworks in place to describe your domain.
Table of Contents (4 chapters)
Chapter 4
Intermediate Scala Tricks
Content Locked
Section 2
Function declaration tricks
In this video, we will implement functions with default arguments and pass-by-name arguments. - Implement a function with default arguments - Understand how argument names and default args interact - Implement pass-by-name arguments and understand how they work