Skip to content
José Valim edited this page Aug 28, 2023 · 38 revisions

1. What are the main problem domains Elixir is suitable for?

In short:

  • data processing
  • embedded software and systems
  • network related tasks: from plain sockets to web servers and frameworks
  • writing reliable, distributed, and highly available software
  • numerical computing and machine learning as of late 2022

2. How do I start a shell (IEx) with my project and all its dependencies loaded and started?

iex -S mix inside your project's directory.

2.1. How to have my IEx session history to be persistent over different IEx sessions?

If you have OTP 20 or greater installed you can run export ERL_AFLAGS="-kernel shell_history enabled" from your shell's profile.

3. Why is my list of integers printed as a string?

For example:

iex(1)> [27, 35, 51]
~c"\e#3"

Pretty-printing of lists is done by using Erlang's native function. It is designed to print lists as strings when all elements of the list are valid ASCII codes.

You can avoid this by appending 0 to your list, or by disabling char list printing:

iex(2)> [27, 35, 51] ++ [0]
[27, 35, 51, 0]

iex(3)> inspect [27, 35, 51], charlists: :as_lists
"[27,35,51]"

Also see this post to the Elixir-Lang mailing list for a bit more on the reasoning behind this design choice: https://groups.google.com/d/msg/elixir-lang-talk/0xxH9HxdQnU/LHgK8elhEQAJ

4. Which functions are allowed in guards?

The Erlang VM only allows a limited set of expressions in guards. For an up to date list please read the official guards reference.