map_idx_val multimethod

Methods

map_idx_val(e:Eachable1, mapper:Fun) Source: stdlib.ngs:1779
Map an Eachable1 to an Arr (array) of values using mapper mapper is called as mapper(INDEX, ITEM)

Returns

New Arr

Example

echo("Array items: " + ArrLike().push(10).push(20).push(30).map_idx_val(F(idx, val) "[$idx]=$val").join(", "))
# Outputs: Array items: [0]=10, [1]=20, [2]=30
map_idx_val(arr:Arr, mapper:Fun) Source: stdlib.ngs:1787
Map an Arr to an Arr (array) of values using mapper mapper is called as mapper(INDEX, ITEM)

Returns

New Arr

Example

echo("Array items: " + [10,20,30].map_idx_val(F(idx, val) "[$idx]=$val").join(", "))
# Outputs: Array items: [0]=10, [1]=20, [2]=30