-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Elixir will most likely show worse performance compared to a compiled imperative language when performing a strictly sequential (CPU) or uniformly parallel (GPU) computation. However, there are lots of use-cases where Erlang's concurrency features (that Elixir takes full advantage of) might be put to good use in mathematical computation contexts.
Here are a few resources on the subject that describe technical computing in Erlang (applies to Elixir as well).
- From Telecom Networks to Neural Networks; Erlang, as the unintentional Neural Network Programming Language [video]
- High-performance Technical Computing with Erlang [slides]
- When does Erlang's parallelism overcome its weaknesses in numeric computing? [stackoverflow.com]
- Go, F# and Erlang -- implementation of matrix multiplication and prime number test in each of the three languages [paper]
Furthermore, most languages rely on Fortran or C libraries to perform numeric computing, and those can be integrated into the Erlang VM via NIFs (Native Implemented Functions).
iex -S mix
inside your project's directory.
If you have OTP 20 or greater installed you can run export ERL_AFLAGS="-kernel shell_history enabled"
from
your shell's profile.
For example:
iex(1)> [27, 35, 51]
'\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
The Erlang VM only allows a limited set of expressions in guards. For an up to date list please read Expressions in guard clauses in the Elixir Website.