by whizzkid · 7y ago · 0 comments
You will start feeling the magic around chapter 4 with pattern matching and the rest gets just better :)
Try not to migrate your "how to .." thoughts from other languages into Elixir. It has some uniqe ways to solve everyday problems.
Have your interactive elixir console ready to play with as well, good luck!
I get frustrated at least once a week trying to use it in a language that doesn't have it. My brain just thinks in pattern matching!
The other related feature whose lack I regularly lament in most languages is multiple function heads, which apparently is rarely used in the ML family tree, bafflingly.
From digging a bit it appears to be somewhat the JVM's fault[0] and quite a lot of it is simply that it's a different type of language from Erlang.
In Erlang, nearly every line of code involves pattern matching, regardless of whether the developer takes advantage of it or not. Every assignment statement, every function return, every function parameter, is an exercise in pattern matching. It's at the core of the language, not an add-on.
As I mentioned in another comment, a closely-related feature that really shows it to its full advantage is multiple function heads/clauses.