Header logo.
small hallucinations
homeyearstagsaboutrss

Reading “Elixir in Action”

I finished reading  "Elixir in  Action." It's a great book that explains complex and novel (at least to me) ideas in simple and clear language.

In each  chapter, the author illustrates a set of new concepts with simple code examples and occasional exercises. As you go deeper  into the book, you'll clearly see how new concepts are built on top of the simpler concepts introduced earlier. It feels like recursion.

At its core, Elixir is very, very simple. You define small functions that perform specific tasks. You can specify the conditions under which these functions run using the when clause and pattern matching of parameters. You then build larger functions by iteratively composing smaller functions.

The notions of pure functions and immutability go hand in hand. They  may  seem  like  constraints on the  surface, until you  realize they have liberated you from asking  yourself,  "Am I manipulating this list in place or  not?" or  "Is this pointer mutable or  not?" No, you didn't change the list in place. No, it's not  mutable, and you don't need to worry about pointers.

The most basic way to coordinate processes is by sending messages.  A process quits when it has received and processed a message. To persist  a process, you recursively call the function that receives messages. There are complex features, but at the core are these simple notions. This makes it much easier to think about than  goroutines and  channels.

Go and read it.