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.


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

ARRAY_SELECT is a map function (also known in mathematics as a function Use this function to take one list, and create a new list, where each element is based on an item from the original.


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


Example 1

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


Example 2

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



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.


Related Articles