Lists are a sequence of values that are enclosed with square brackets [].

Lists in Elixir are actually stored in memory as linked lists. Each element holds both its value and a pointer to the next element.

elixir

# Define a list
list = [1, 2, 3]
    

Considerations

  • To compute the length of a list, the whole list needs to be traversed.
  • Performance of list concatenation depends on the length of the lists.

Tags

elixir