map()
Creates a list of corresponding values for a given index list
syntax
map ( indices: list, values: list ) : list
For every index in the index list, map performs a lookup in the values list and adds the found value to the output.
parameters
indices | a list of indices into the values list |
values | a list of values |
return
a list containing the values corresponding to the indices in the same order as in the index list
examples
map ( [1, 2, 3, 2], [ "x", "y", "z" ] );
returns [ “x”, “y”, “z”, “y” ]
map ( pool (3d6), [1,2,3,1,2,3] )
returns a list of 3 results for a simulation of a classic d3 roll.1)
1)
of course, using 3d3 is more efficient.