Elixir Language Maps and Keyword Lists


  • map = %{} // creates an empty map
  • map = %{:a => 1, :b => 2} // creates a non-empty map
  • list = [] // creates an empty list
  • list = [{:a, 1}, {:b, 2}] // creates a non-empty keyword list


Elixir provides two associative data structures: maps and keyword lists.

Maps are the Elixir key-value (also called dictionary or hash in other languages) type.

Keyword lists are tuples of key/value that associate a value to a certain key. They are generally used as options for a function call.