Lists are ordered data structures that contain multiple items.
The list is processed as a whole rather than processing items individually. This is more efficient for computers.
Take a herd (or tower) of Giraffes, for example. You could consider each Giraffe an item within the list (or herd). A scientist studying Giraffes would likely study groups of animals rather than treating each Giraffe individually - the same is true of a computer program processing lists.
This is a list - a herd of Giraffes.
This is not a list. it is a single item - one Giraffe
You can think of a list as a single row of values stored in sequence, one after the other. Suppose you want to store a list of your favorite animals.
For example:
Giraffe | Rhino | Hippo | Tiger | Impala |
---|
Each position in the list is numbered using an index. One thing to remember is that the first item in a list is at position 0, not 1. So when we say "the first item," we actually mean the one at index 0 (zero-based indexing).
Remember our list of favorite animals? You would probably count the list as 1, 2, 3. But in programming, the numbers would go from 0 to 2 if you made a list of those animals. It might seem odd at first, but starting at 0 is common in most computer systems.
<aside>
Note that we still have 3 items in the list; it’s just that the list is using a zero-based counting system.
</aside>
Index | 0 | 1 | 2 |
---|---|---|---|
Giraffe | Rhino | Hippo |
The Lists transforms are a category that create or query lists.
Lists are ordered data structures that contain multiple items.
You can perform a variety of functions on lists. Using our favorite animal example, we can do things like:
And much more!
Lists, by virtue of being a data structure containing multiple items, are more efficient for computation than processing lots of unique individual items. However, working with lists does require some additional logic in the set up of our Flows to process.
Simply, you can tell if a data structure is a list if it contains multiple items. You might ask, how can I tell if a structure contains multiple items?
The easiest way to know is if what you would expect to see resulting on the map is more than one basic geometry. For instance:
It is a single rectangle.
Any processing is done to just the single element
This is the same rectangle with the subdivide lots transform applied, which divides the original geometry into multiple sub-geometries.
You will see the [ ] brackets next to the connector on the node if it works with lists.
A node with list input
A node with list outputs
A node with list inputs and outputs
Use the encapsulate in list node to create a list. Many nodes will also result in lists based on the function they perform, such as repeat or any of the dendrogram nodes.
<aside> 💡
To create a list without a mediating node, hold “shift” to connect multiple outputs into the same input
</aside>