List Processing (Part 2) – Mapping / Transformation

There is a sub-set of the ARRAY_* family of functions devoted to creating a new array from a source array.

ARRAY_SELECT

Definition: ARRAY_SELECT(Array $list, $(i, item) transform)

ARRAY_SELECT is a map function (also known in mathematics as a function https://en.wikipedia.org/wiki/Function_%28mathematics%29). Use this function to take one list, and create a new list, where each element is based on an item from the original.

18

Or more visually – each item in the result is the result of a mathematical function applied to each item:

19

Example 1

The simplest example usage of ARRAY_SELECT will take a list, and return an identical list.

21

Example 2

Take one list of numbers, and add 1 to each item.

22

ARRAY_SELECTMANY

Definition: ARRAY_SELECTMANY(Array $list, $(i, item) transformAndGetList)

This function is very similar to ARRAY_SELECT, except that the resulting array is merged into a single result array.

23

Related Articles