I have freshly started (today!) a student apprenticeship with 8th Light where I will be learning many new things, including three types of languages; one statically typed language, one dynamically typed language and one functional language. The functional language I am going to learn is called Elixir.

Functional Programming languages use expressions, and are declarative. They avoid mutability (the ability to change), which leads to fewer side-effects. Ideally your code should always return an expected output, and functional programming’s reliance on mathematical functions eternally returning the same result when run allows this. I will not pretend that I understand a lot of the things that define functional programming, but that should all become clearer with time.

Getting Started

Elixir can be installed using brew update followed by brew install elixir, or by following the instructions on their website. Elixir is build on top of Erlang, so brew should install both. You can check this by running elixir -v and erl -v to return their version numbers.

If you are using Vim, you can configure your ~/.vimrc file with the Vim Elixir plugin.

The Elixir Console

The Elixir console can be accessed with the command iex. In this environment one can experiment with different types of Elixir expressions and help is only an h command away. In fact the documentation for every Elixir module can be accessed by using the help command with the module as an argument like so:

Handy!

Learning with Koans

8th Light have written some Elixir koans to help learn syntax, modules and data-types. In order to try them, git clone the url, cd into the freshly cloned directory, split your panes and run one with the instructions on the github readme, the other completing and saving each exercise within the koans directory in order. Each time you save the file the tests will run, and tell you whether you have aced it or not.