map
takes a source array and maps it using keypath argument, producing another array with different data.
zip
takes a source array and converts it into a dictionary with numeric indexes:
{[ var myDictionary @zip(myArray) /]}
For example, let's assume myArray
contained names of people ["Anna", "Hanna", "Joe"]
. Sometimes, it is also important to know index of the item in the source array. zip
provides just that:
{[ map @zip(myArray) into index name /]}#{{ index }} - {{ name }}{[/]}
Correctly producing iteration index. Keep in mind that indexes start from 0
:
#0 - Anna#1 - Hanna#2 - Joe