Fun with Functions
Functions are simple at first glance—they have a name, arguments, and a body. But Elixir allows you to overload functions in several different ways that aren’t possible in most other languages. Even though they are simple, this ability to overload them makes functions very powerful.
You wrote named functions in the previous section. In this section, you’ll deal with anonymous functions. Anonymous functions are a quick and convenient way to define functions inline in your code.
Let’s get started with anonymous functions.
Anonymous Functions
Anonymous functions are ones that have no name. They are commonly used when passing behavior into a different function, such as an enumeration function.
Anonymous functions are quick and ...
Get From Ruby to Elixir 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.