February 2018
Beginner
200 pages
4h 37m
English
Conventional languages use mutating shared values that require thread and lock mechanisms to work with concurrency and parallelism. In functional programming, all values you create in your program are immutable. By default, each function will have a stable value. That means we don’t need lock mechanisms, which simplifies the parallel work. It changes everything about building software.
Look at this Elixir code:
| | list = [1, 2, 3, 4] |
| | List.delete_at(list, -1) |
| | # => [4] |
| | |
| | list ++ [1] |
| | # => [1, 2, 3, 4, 1] |
| | |
| | IO.inspect list |
| | # => [1, 2, 3, 4] |
The value of list is immutable: no matter the operation we apply to it, it will generate new values. If the list is immutable and each operation has a safe value, the compiler ...
Read now
Unlock full access