We cover:

  • The two and a half dictionary data types
  • Pattern matching and updating maps
  • Structs
  • Nested data structures

Chapter 8Maps, Keyword Lists, Sets, and Structs

A dictionary is a data type that associates keys with values.

We’ve already looked briefly at the dictionary types: maps and keyword lists. In this short chapter we’ll cover how to use them with pattern matching and how to update them. Then we’ll dive into structs, a special kind of map with a fixed structure. Finally we’ll explore nested data structures and see how to alter fields in a map inside another map inside another map.…

First, though, let’s answer a common question—how do we choose an appropriate dictionary type for a particular need?

Get Programming Elixir ≥ 1.6 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.