Your Turn
Tuples represent sequential data in Elixir. While tuples can be arbitrarily long, we’ll tend to keep tuples short to make them easy to read. Also, while full APIs exist to transform tuples, for efficiency reasons, we’ll create them once in their final form.
The functions we build work best if the functions all take data of the same shape, meaning tuples that all represent the same type. We built a function to work with points. Our points were tuples with an x and y coordinate.
We built two special types of functions. We used constructors to name concepts and keep data pure. We used reducers to perform operations that also returned points. Rather than mutating a point, our reducers created whole new points we transformed in some way. ...
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