Lists
Let’s learn about the properties and uses of lists in Elixir.
We'll cover the following
One of the most important data structures in Elixir is the list. If you’re thinking about skipping this section because lists are arrays, please stop and read on. In Elixir, lists are singly linked, meaning that each node of a list points to the next node. That’s hugely different than arrays. Arrays make random access cheap, but traversing lists takes longer.
Here’s the main point. In Elixir, a list with n elements is n different lists. Said another way, we can accurately represent [1, 2, 3]
with a list construction operator, called cons cells, like this:
Get hands-on with 1200+ tech skills courses.