A keyword list is a list of two-element tuples whose keys are atoms and whose values can have any type. It suits small key-value structures and optional function arguments. section 2.4.11
Use keyword lists when:
- You need readable key-value pairs such as [monday: 1, tuesday: 2]. section 2.4.11
- You want optional arguments, including the trailing keyword-list syntax accepted by functions such as IO.inspect/2. section 2.4.11
- You can accept linear lookup, because fetching a key has O(n) complexity. section 2.4.11
Inspect options
IO.inspect([100, 200, 300], width: 3, limit: 1) prints a constrained representation. The same options can be written as a keyword-list argument. section 2.4.11
