May 2018
Intermediate to advanced
412 pages
9h 3m
English
Elixir’s pattern matching is similar to Erlang’s (the main difference being that Elixir allows a match to reassign to a variable that was assigned in a prior match, whereas in Erlang a variable can be assigned only once).
Joe Armstrong, Erlang’s creator, compares the equals sign in Erlang to that used in algebra. When you write the equation x = a + 1, you are not assigning the value of a + 1 to x. Instead you’re simply asserting that the expressions x and a + 1 have the same value. If you know the value of x, you can work out the value of a, and vice versa.
His point is that you had to unlearn the algebraic meaning of = when you first came across assignment in imperative programming languages. Now’s ...
Read now
Unlock full access