It’s not a secret that Programmers like a great holy war. The echos of passionate programmers shouting with their banners high will live on Stack Overflow for eternity, or at least archive.org.

The editor wars rage on. Like other holy wars, object-oriented vs. functional programming is an ongoing saga. Most programmers use functional programming while considering themselves object-oriented programmers. Many languages have incorporated object-oriented and functional programming language paradigms.

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

Workflow

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.


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 this is good if you’re doing quick and dirty code for a single task.

Look at that; with 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’ve convinced myself that learning Elixir is worth the investment.

Learning Elixir - Beyond the Basics


Other Learning