Skip to content
Blog

Map Functions

Map functions are used to create and manipulate mappings. Maps are different from structs in that the key does not have to be a string. The following table lists the functions that can be used with maps.

FunctionDescriptionExampleResult
map(keys, values)create a mapmap([1, 2], ['a', 'b']){1=a, 2=b}
map_extract(map, key)returning a list containing the value for given key
or empty list if key is not found
map_extract(map([1, 2], ['a', 'b']), 1)['a']
element_at(map, key)alias of map_extractelement_at(map([1, 2], ['a', 'b']), 1)['a']
cardinality(map)returns the size of the mapcardinality(map([1, 2], ['a', 'b']))2
map_keys(map)returns all keys in the mapmap_keys(map([1, 2], ['a', 'b']))[1,2]
map_values(map)returns all values in the mapmap_values(map([1, 2], ['a', 'b']))[a,b]