Chapter 4Modules and Functions

Modules and functions are the basic units from which sequential and parallel programs are built. Modules contain functions, and the functions can be run sequentially or in parallel.

This chapter builds upon the ideas of pattern matching from the previous chapter and introduces all the control statements we need for writing code. We’ll be talking about higher-order functions (called funs) and how they can be used to create your own control abstractions. Also, we’ll talk about list comprehensions, guards, records, and case expressions and show how they are used in small fragments of code.

Let’s get to work.

Get Programming Erlang, 2nd Edition 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.