Collections and Enum
Elixir has a small set of collections and one module that works on almost all of them. This part covers the list, the tuple, the map and the keyword list, then Enum: the functions a collection lives on once it exists, the grouping, sorting and counting calls a report is made of, nested data read with get_in, and a set that answers membership without duplicates.
The cost of each collection is part of the lesson. A list is cheap at the head and dear at the end, a map is the key store of the language, and Enum runs eagerly, which the next part changes.
5.1
Lists
the literal, head and tail, prepend and concatenate, and what each one costs
Open
5.2
Tuples
the literal, elem and put_elem, and why a tuple is a fixed shape
Open
5.3
Maps
the literal, dot and bracket access, the update, and the key types a map takes
Open
5.4
Keyword lists
the options list, Keyword.get and fetch, and why a map is usually the better key store
Open
5.5
Enum in Elixir
map, filter, reduce and the rest of the functions a list lives on
Open
5.6
group_by, sort_by and the aggregates
grouping, sorting by a key, frequencies, min, max and sum
Open
5.7
Nested data
a map of lists of maps, get_in and put_in, and a shape that stays readable
Open
5.8
MapSet and the conversions
a set without duplicates, Enum.into, Map.new and the type to pick
Open