O'Reilly logo

Learning Elixir by Kenny Ballou

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Determinism

There is a lot of emphasis on the results of these branching expressions returning a value. This is a natural result of Elixir's functional nature.

Like with functions, we can more easily grok and reason about branching code if the code itself is deterministic. If it always returns a result, the branches are tractable. Our mental compilers are able to trace the code and see the result without much extra thought.

The branching examples we have done don't nest either. This arises because it is often unnecessary in functional languages to nest conditions. The syntax often lends itself to allow a single level of branching. If there's more branching, it's in another function, or implicit with pattern matching, or both; we only mentally page ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required