Playing With Fire

Exploring the web one Elixir at a time

What is this Elixir anyway?

I thought that I should spend some time looking at the basics of Elixir. I will try very hard not to rehash the material that is already out there, but some crossovers might happen.

If you are looking for a more indepth/professional job, I would suggest that you read both [Programming Elixir](“Programming Elixir” or [Introducing Elixir](“Introducing Elixir” and check out [Getting Started with Elixir](“Getting Started with Elixir”

Anyway, here goes…


What is Elixir?


Elixir is a strongly-typed functional programming language. In common with other FP languages (Haskell, Erlang, Clojure), types are generally inferred by the compiler, meaning that explicit variable typing is not required. There may be occasions where the compiler needs a little help and there is a mechanism for doing that, but normally that is not required.

Additionally, Elixir runs on the Erlang VM, so everything that comes with Erlang is accessible in Elixir. This is somewhat similar to both Clojure and Scala on the JVM.

Elixir syntax is Ruby-ish in nature. But that is where the similarities end. Elixir is not Erlang in Ruby clothing.

With that misconception out of the way…


How do I install Elixir?


I would recommend that you read this: [Installing Elixir](“Installing Elixir”  

With Elixir installed, what do I do now?


As I’m on a system that uses symlinks (i.e. not Windows), I have created symlinks to the various parts of Elixir so that they are accessible from wherever I am.

sudo ln -s elixir /usr/local/bin/elixir
sudo ln -s elixirc /usr/local/bin/elixirc
sudo ln -s iex /usr/local/bin/iex
sudo ln -s mix /usr/local/bin/mix

This may or may not be necessary, depending on how you installed it and how you want to run it and if the installation directory is on your env path.

To test your installation, if you haven’t already done so, in a terminal/console:

$ elixir —version

and you should see a version string printed out.

With a successful result to that test, you should now be able to access iex, InteractiveElixir. This is a REPL (Read, Evaluate, Print, Loop), like python, irb or erl.

if you type in iex into terminal, like so:

$ iex

you should be greeted with some text showing the Erlang and Elixir versions and ultimately a prompt:


iex can be used to experiment with and test code and will be our playground for a bit.

To exit iex, press ctrl-c twice.

With that all done, we can now start to explore… Elixir Variables, which will be the subject of my next post.