map

Table of Contents

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:

yield map(this, upper)
["foo","bar","baz"] 
Loading...

Using a user-defined function to convert epoch floats to time values:

func floatToTime(x): (
  cast(x*1000000000, <time>)
)
yield map(this, floatToTime)
[1697151533.41415,1697151540.716529] 
Loading...
Next: missing

SuperDB