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 a list - a herd of Giraffes.

This is not a list. it is a single item - one Giraffe

This is not a list. it is a single item - one Giraffe

List Structure

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

0-Based Index

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

List Functions

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:

  1. Count how many animals are in the list
  2. Find out if the list contains “Hippo”
  3. Find the location of “Giraffe”
  4. Grab Rhino from the list
  5. Add more animals to the list
  6. Add more information to everything in the list (imagine we want to also store the color of the animal)

And much more!

Working with Lists

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.

Identify a list

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:

This is not a list.

It is a single rectangle.

Any processing is done to just the single element

image.png

This is a list.

This is the same rectangle with the subdivide lots transform applied, which divides the original geometry into multiple sub-geometries.

image.png

How to know if a node expects or creates a list?

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 input

A node with list outputs

A node with list outputs

A node with list inputs and outputs

A node with list inputs and outputs

Create a list

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>

Create and Query lists with List nodes:

Untitled

Processing Lists