Chapter 5Using Collections
In this chapter, we’ll investigate three ways to handle multiple, related pieces of data: tuples, lists, and arrays:
-
Tuples let you collect items with different data types. They usually hold only a few items.
-
Lists have elements that are all of the same data type, and are meant to be traversed from beginning to end.
-
Array elements also must be of the same data type, but they allow efficient random access to the elements.
For lists and arrays, we’ll learn about the Belt.List and Belt.Array modules, which contain a large number of functions that make it easier to manipulate these collections. We’ll also start using three very important higher-order functions: map, reduce, and keep. Combining these functions lets you ...
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