Transforming Data
Applications need to actually do things to be useful. The essence of creating that behavior in functional programming is transforming data. This whole next section will be about just that—defining functions that transform the data structures we’ve defined.
Elixir gives us the pipeline operator |>, which allows us to elegantly take the output of a function and give it to another function as its first argument. It’s tailor-made for the kind of work we’ll be doing, and it’s very idiomatic in Elixir.
We can think of pipelines as chaining functions together vertically. We can also chain them horizontally—functions calling functions either in the same module or across modules.
We’ll use both approaches to take complex work, break ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access