This repository shows my journey learning Elixir by following the official documentation, especially the "Getting Started" section. Instead of using IEx or livebook.dev, I decided to go right into a Mix project. This lets me get used to the real workflow of an Elixir project and start coding right away.
For each chapter, I make a module to follow the examples in the documentation and then recreate
them using my own functions, keeping them close to the original examples. This practice helps me
get familiar with writing production-quality code. I’m also learning to add @moduledoc
, @doc
,
and @spec
comments and practice TDD with ExUnit
. My goal is to understand Elixir basics well
before moving on to learning Phoenix.
I also use the book Elixir in Action , which is a recommended resource for learning Elixir. I purchased the 3rd edition, which is based on Elixir version 1.15.
Install Erlang and Elixir. This project uses Erlang v27.1.1
and Elixir v1.17.3
. To manage
multiple versions of Erlang and Elixir, try the
vfox version manager.
Clone this project to your local machine:
# Using HTTPS
git clone https://github.com/muzhawir/learn_elixir_from_documentation.git
# Using GitHub CLI
gh repo clone muzhawir/learn_elixir_from_documentation
Then go to the project directory and install dependencies:
cd learn_elixir_from_documentation
mix deps.get
This repository uses these packages:
- credo: A static analysis tool that helps write better Elixir code by pointing out common mistakes and inconsistencies. It’s a great tool for beginners who want to learn to code well in Elixir.
- styler: A formatting tool for Elixir. Styler combines
the functions of
mix format
andmix credo
to fix code style automatically. I use both Credo and Styler to see how they work together, though for beginners, I recommend starting with Credo. - dialyxir: Since each function has
@spec
, I use Dialyxir to check type specifications with Dialyzer. Dialyzer finds issues like type errors, unreachable code, and unnecessary tests. Dialyxir makes Dialyzer easier to use in Elixir projects.
- Basic Types
- Lists and Tuples
- Pattern Matching
-
case
,cond
, andif
- Anonymous Functions
- Binaries, Strings, and Charlists
- Keyword Lists and Maps
- Modules and Functions
- Recursion
- Enumerables and Streams
- Processes
- IO and the File System
-
alias
,require
,import
, anduse
- Module Attributes
- Structs
- Protocols
- Comprehensions
- Sigils
-
try
,catch
, andrescue
- Writing Documentation
- Optional Syntax Sheet
- Erlang Libraries
- Debugging