TL;DR

It's impossible to create circular structures with elixir due the immutability, however there are some workaround to build them.

Immutability is a two edged sword, while it is thread safe, more error proof and have others benefits that help builds the foundation of beam. This come with a cost, like everything.

Circular list, graphs, trees with parent and a others data structures can not be build in elixir as in others programming languages.

Per example, imagine a list which: A -> B -> A

Since A links to B, then B needs to exist in advanced, however as B…

Guilherme Torres Castro

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store