list ++ [value]
Common Pitfalls in Elixir Coding
Blackode
612

I think this as an example is bit misleading for beginners to Elixir. While technically correct, using a [linked] list like this goes against what it is designed for — which is writing to the head, not the tail. The latter is not memory/operation efficient.

Most use cases for the array could easily be replaced with a linked list, but the linked list is a leakier abstraction than most implementations of the array and requires a little more forethought to use properly.

Great article otherwise and thanks for contributing to the growing body of Elixir resources out there!

Show your support

Clapping shows how much you appreciated Pierre Lebrun’s story.