Chapter 2. Data Types and Structures
This chapter will cover the following recipes:
- Understanding immutability
- Adding and subtracting lists
- Combining tuples into a list
- Creating and manipulating keyword lists
- Using pattern matching
- Pattern matching an HTTPoison response
- Creating a key/value store with a map
- Mapping and reducing enumerables
- Generating lazy (even infinite) sequences
- Streaming a file as a resource
In Elixir, data, once created, is immutable. Whenever some input is passed into a function to be transformed, the original value remains unchanged and a new value is created.
This allows for safe concurrent access to the same data by n processes. It makes concurrency easier to manage, as it is guaranteed that no process can ...