map
Function
map — apply a function to each element of an array or set
Synopsis
map(v: array|set, f: function) -> array|set
Description
The map function applies function f to every element in array or set v and
returns an array or set of the results. Function f must be a function that takes
only one argument. f may be a user-defined function.
Examples
Upper case each element of an array:
values map(this, upper)["foo","bar","baz"]Loading...echo '["foo","bar","baz"]' \
| super -s -c 'values map(this, upper)' -Using a user-defined function to convert epoch floats to time values:
func floatToTime(x): (
  cast(x*1000000000, <time>)
)
values map(this, floatToTime)[1697151533.41415,1697151540.716529]Loading...echo '[1697151533.41415,1697151540.716529]' \
| super -s -c 'func floatToTime(x): (
  cast(x*1000000000, <time>)
)
values map(this, floatToTime)' -