15 Anonymous functions

After reading this lesson, you will be able to

  • Implement anonymous functions
  • Code using the concise notation for anonymous functions

In lesson 6, you learned the basics of functions in Scala. In this lesson, you’ll discover a new type of function: anonymous. Anonymous functions are functions that you can define quickly and concisely. At first, they may seem just an alternative to the standard Scala functions you have seen so far, but you’ll soon discover that they are particularly handy when combined with another type of function called higher order. The concept of an anonymous function is not unique to Scala; other languages, such as Java 8+ and Python, refer to it as lambda. In the capstone, you will use a particular ...

Get Get Programming with Scala 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.