Data Structures & Algorithms in Elixir
Introduction
What happens if you learn Elixir as your first programming language?
Follow along on this journey, as I learn Elixir and try to implement famous Data Structures and Algorithms in Elixir.
People often find it strange that for all the clout around Elixir, it doesn’t have for-while loops or if-else blocks. Yet, it is true. Elixir discourages the use of for-while loops & if-else blocks. Being an immutable language, it discourages the typical use of i += 1 type code in loops.
Yet, for all its strangeness, it still stands out in the crowd.
Elixir is massively fault-tolerent, scalable and supports concurrency right out of the box. The pipe operator makes the syntax clean and readable, giving you a clear idea about the control flow.
Instead of if-else blocks, we have recursion & pattern matching. Any block of code has a few functions calling each other with different arities multiple times. Recursion and pattern matching form the crux of functional programming in Eliixr.
Enough said. Let’s get started.
First up, the sorting algorithms-