A lot of developers learn most efficiently by doing, preferably with something useful at the end of doing, so if you have a small personal project to work on that can be a great platform for learning.
Feel free to ask questions on here. I think it’s fair to say that there’s a high proportion of enthusiasts who love the language, libraries and runtime after earning too many grey hairs from other platforms, and are more than happy to help beginners get going providing they are making some effort to self-learn along the way.
In terms of weird symbols etc, here are a couple of pointers to things that I found to be very different in the early days:
|>
- pipe the output of one function into another as the first argument - pretty much like unix-style command line pipes.
:an_atom
- this got me at first becomes I didn’t come from the school of Ruby - it’s basically a constant, but there are a few little tricks - you can google these. Here’s a starting point: syntax - Why is useful to have a atom type (like in elixir, erlang)? - Stack Overflow
~s(something or other)
- a sigil - basically the contents within the brackets are processed in a special way depending on which sigil is used. Well documented in the language guide: Sigils - The Elixir programming language
<-
and ->
are just part of syntax in case
& for
- you’re just going to have to practise with those
There’s some really tight syntax for in-line defined functions can be super-confusing at first. For example (from Enumerables and Streams - The Elixir programming language):
1..100_000 |> Enum.map(&(&1 * 3))
This means, for each value between 1 and 100,000, multiple by 3.
The ..
between 1 and 100_000 indicate the generation of a range. That range is passed in to Enum.map
as the first argument by the |>
, and an in-line function is passed in as the second argument.
&(&1 * 3)
is the in-line function defined in place rather than being defined elsewhere and referenced. The &
at the beginning indicates the start of the function definition and the &1
indicates the first (and only) variable passed into the function. There’s a little bit of discussion of this syntax here: Modules and functions - The Elixir programming language
While it seems overly terse at first, it turns out to be really useful as a way to define a simple transformation to apply to a list of data.
Finally, the whole pattern-matching thing is confusing if you haven’t come across it before. I tried to understand it by reading about it, but in the end I got my head around it by playing in the interactive shell. It’s like a combination of equality-checking and assignment depending on what elements of a match expression are able to be assigned to. Once you do grok it, pattern-matching is one of the language features that makes Elixir super-readable.
Again, feel free to ask about specific things…