April 2016
Beginner to intermediate
300 pages
6h 58m
English
Phoenix is built on Elixir, which is a beautiful language, so we’re going to use Elixir to talk about the way the layers of Phoenix fit together. In Elixir, we might have a couple of functions like these:
| | def inc(x), do: x + 1 |
| | def dec(x), do: x - 1 |
We can chain together several different function calls like this:
| | 2 |> inc |> inc |> dec |
The |>, or pipe operator, takes the value on the left and passes it as the first argument to the function on the right. We call these compositions pipes or pipelines, and we call each individual function a segment or pipe segment.
There’s a side benefit, though. Pipelines are also functions. That means you can make pipelines of pipelines. This idea will help you understand how the ...