Immutability and Memory

Get introduced to the pipe operator and immutability in Elixir.

The pipe operator

The pipe operator |> is one of the first constructs Elixir developers learn because it embodies transformation and the decoupling between data and behavior. When we pipe between functions, the pipe operator receives all data it needs as input and returns all relevant information as output. There’s never hidden or mutated data. Each pipe is a standalone transformation with an explicit contract.

When writing our business logic, we may use Ecto changesets to handle datacasting and validation:

Get hands-on with 1200+ tech skills courses.