Learning Elixir

Learning Elixir for fun and profit? It’s not a secret that Programmers like a great holy war. The echos of passionate programmers shouting with their banners high live on Stack Overflow for eternity.

The editor wars rage on. Like many other holy wars, object-oriented vs. functional programming is an ongoing saga. Most programmers use functional programming even if they consider themselves object-oriented programmers. Many languages have become pragmatic and support both object-oriented and functional programming language paradigms.

I’ve enjoyed using the functional features of C# in the past and dabbled a bit with F#. I’ve never dove headfirst into a functional oriented language like Elixir. I mostly picked it up because I like The Pragmatic Programmer book and Dave Thomas as an author in general. I’m also interested in being able to do concurrent programming with less of a hassle.


My workflow is a split window with the book and my IDE side by side on my Macbook. I’m trying things out as the material progresses and am running through the exercises.

My Workflow

Programming Elixir

As I traverse the Programming Elixir book, I feel like I’m learning regular expressions. These terse expressions are power-packed, look at this beauty.

# The long way
add_one = fn (n) -> n + 1 end
IO.puts add_one.(1)

# The short way
add_one = &(&1 + 1)
IO.puts add_one.(1)

Building quick little inline functions will take little effort. It’s a bit cryptic for my tastes, but if you’re doing quick and dirty code for a single task, this is a good thing.

Look at that, a few regular expressions and concise syntax, this code returns true.

match_end = & ~r/.*#{&1}$/
IO.puts "cat" =~ match_end.("t")

This code boggles my mind. I can have a set of regex libraries that are named appropriately. I can chain those expressions… what?!

I just convinced myself that learning Elixir is worth the investment.

Learning Elixir – Beyond the Basics