What is this Elixir anyway?
Posted on November 07, 2014 by Clive in Elixir
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” https://pragprog.com/book/elixir/programming-elixir) or [Introducing Elixir](“Introducing Elixir” http://shop.oreilly.com/product/0636920030584.do) and check out [Getting Started with Elixir](“Getting Started with Elixir” http://elixir-lang.org/getting_started/1.html). Anyway, here goes… 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… I would recommend that you read this: [Installing Elixir](“Installing Elixir” http://elixir-lang.org/install.html)
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. 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: 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: 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.What is Elixir?
How do I install Elixir?
With Elixir installed, what do I do now?
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
$ elixir —version
$ iex
iex(1)>