Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Simple diagrams and resources to help learning Elixir, Phoenix, Ecto and other u
- [10 tips for new elixir developpers](#10-tips-for-new-elixir-developpers)
- [Elixir cheat sheet](#elixir-cheat-sheet)
- [Elixir learning path](#elixir-learning-path)
- [Level 1 (Elixir)](#level-1-elixir)
- [Section 1 (Elixir)](#section-1-elixir)
- [Installing Elixir and Running IEx](#installing-elixir-and-running-iex)
- [Elixir guide styles (non exhaustive)](#elixir-guide-styles-non-exhaustive)
- [Basics (Getting started with Elixir)](#basics-getting-started-with-elixir)
Expand All @@ -24,7 +24,9 @@ Simple diagrams and resources to help learning Elixir, Phoenix, Ecto and other u
- [Controls Structures (cond, with, case, if)](#controls-structures-cond-with-case-if)
- [IO and files](#io-and-files)
- [Debugging with Elixir](#debugging-with-elixir)
- [Level 2 (Phoenix, Ecto and OTP basics)](#level-2-phoenix-ecto-and-otp-basics)
- [👣 Get your feet wet](#-get-your-feet-wet)
- [Section 1 exercises](#section-1-exercises)
- [Section 2 (Phoenix, Ecto and OTP basics)](#section-2-phoenix-ecto-and-otp-basics)
- [Mix](#mix)
- [Errors and Exceptions](#errors-and-exceptions)
- [Testing your code](#testing-your-code)
Expand All @@ -33,7 +35,7 @@ Simple diagrams and resources to help learning Elixir, Phoenix, Ecto and other u
- [OTP Basics](#otp-basics)
- [Phoenix](#phoenix)
- [Ecto](#ecto)
- [Level 3 (OTP, MetaProgramming)](#level-3-otp-metaprogramming)
- [Section 3 (OTP, MetaProgramming)](#section-3-otp-metaprogramming)
- [Processes (Spawn, Links, Tasks, etc.)](#processes-spawn-links-tasks-etc)
- [Supervisors](#supervisors)
- [AST](#ast)
Expand Down Expand Up @@ -95,7 +97,7 @@ Anyone can contribute, add resources, links and update mermaid diagrams :) Feel

# Elixir learning path

## Level 1 (Elixir)
## Section 1 (Elixir)

→ At this level, you can practice coding with Elixir using the [Exercism’s Elixir track](https://exercism.org/tracks/elixir), a website where you can find puzzles and exercises for every Elixir concepts.
Plus, their [Sylabus](https://exercism.org/tracks/elixir/concepts) is great!
Expand Down Expand Up @@ -211,7 +213,16 @@ Doc[Documentation and Typespecs]

- [Three Ways to Debug Code in Elixir by Pulkit Goyal](https://blog.appsignal.com/2021/11/30/three-ways-to-debug-code-in-elixir.html)

## Level 2 (Phoenix, Ecto and OTP basics)
# 👣 Get your feet wet

After reading through all these documentations for the first section, you must have gathered some basic knowledge about Elixir.
Now, let's do a series of exercises covering different concepts we mentioned above, and get yourself more familiar with the language.
The exercises were written in Livebook.

### Section 1 exercises
[![Run in Livebook](https://livebook.dev/badge/v1/black.svg)](https://livebook.dev/run?url=https%3A%2F%2Felixir-learning-path.fly.dev%2Fsessions%2Fxgcbllf6pzsuj7nyhv2qdjock36exfvtv4qydeav)

## Section 2 (Phoenix, Ecto and OTP basics)

```mermaid
graph TD
Expand Down Expand Up @@ -313,7 +324,7 @@ graph TD
- [Ecto.Multi hexdoc](https://hexdocs.pm/ecto/Ecto.Multi.html)
- [Dynamic queries](https://hexdocs.pm/ecto/dynamic-queries.html)

## Level 3 (OTP, MetaProgramming)
## Section 3 (OTP, MetaProgramming)

```mermaid
graph TD
Expand Down
80 changes: 80 additions & 0 deletions exercises/section_1.livemd
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Elixir Learning Path

## Section 1 exercises

Get your hands dirty on Elixir with the series of exercises below. The idea is to write a function that returns expected output, with unit tests implemented.

<!-- livebook:{"break_markdown":true} -->

### String length

Given a string, you need to return the number of characters.

```elixir
defmodule String.Length do
def string_length(string) do
## Your solution here
end
end
```

```elixir
ExUnit.start(auto_run: false)

defmodule String.LengthTest do
use ExUnit.Case, async: false
alias String.Length

describe "string_length/1" do
test "the length of hello is 5" do
assert Length.string_length("hello") == 5
end

test "the length of wikipedia is 9" do
assert Length.string_length("wikipedia") == 9
end

test "the length of dsqsqdqsdeqdfqfaezaezeqsdsqrerdsqdqsdqdqdqs is 43" do
assert Length.string_length("dsqsqdqsdeqdfqfaezaezeqsdsqrerdsqdqsdqdqdqs") == 43
end
end
end

ExUnit.run()
```

### Addition

Write a function that returns the addition of a and b.

```elixir
defmodule Addition do
def add(a, b) when is_integer(a) and is_integer(b) do
## Your solution here
end
end
```

```elixir
ExUnit.start(auto_run: false)

defmodule AdditionTest do
use ExUnit.Case, async: false

describe "add/2" do
test "2 add 1 equals 3" do
assert Addition.add(2, 1) == 3
end

test "532323132 add 2423242424 equals" do
assert Addition.add(532_323_132, 2_423_242_424) == 2_955_565_556
end

test "if one of the element is not integer should transform it and perform addition" do
assert Addition.add("2", 1) == 3
end
end
end

ExUnit.run()
```