Elixir - Difference Between Keyword Lists and Maps

Just started with Elixir's book by Dave Thomas.

It talks about two concepts:

Keyword Lists

[ name: "Dave", city: "Dallas", likes: "Programming" ] 

Cards

 states = %{ "AL" => "Alabama", "WI" => "Wisconsin" } 

When do you pick one over the other?

+6
source share
1 answer

There is a quick overview chapter in the getting started guide: http://elixir-lang.org/getting-started/maps-and-dicts.html

To summarize, keyword lists are used for parameters or when you need to save a user order. Use cards to store actual data.

+6
source

Source: https://habr.com/ru/post/989862/


All Articles