Control flow and collections

Erlang has no loop. This part shows what replaces it: a case or an if that picks one clause, and recursion that walks a list one cell at a time. The accumulator lesson is the one to type out, because every later module uses the shape.

Lists, tuples and maps carry every collection of the course. Each lesson ends with what the structure costs, so the choice at a call site is a decision rather than a habit, and the patterns that read a collection are the same ones the next part uses in a function head. The last two lessons write the same loops as a comprehension and take a map apart as a counter and as a record.

3.1 Conditions: case and if case, if, the guard that picks a clause, and why there is no loop Open 3.2 Recursion replaces loops a base case, an accumulator, and the tail call the runtime optimises Open 3.3 Lists the list cell, head and tail, the list module, and what a list costs Open 3.4 Tuples a fixed group of values, pattern matching, and the records of the standard library Open 3.5 Maps a key to a value, the update syntax, and the maps module Open 3.6 List comprehensions a generator, a filter, and the same form over a binary Open 3.7 Maps in depth the maps module, nested maps, and a map used as a record Open

Lessons