Skip to content

Collections

Build, reshape and query lists, maps and objects.

concat

concat(lists...) → list

Concatenate two or more lists into one.

ParameterTypeDescription
lists...listVariadic.
concat(["a"], ["b", "c"])

→ ["a", "b", "c"]

contains

contains(list, value) → bool

Check whether a list or set contains a given value.

ParameterTypeDescription
listlist
valueany

distinct

distinct(list) → list

Remove duplicate elements from a list.

ParameterTypeDescription
listlist

element

element(list, index) → any

Return the element at the given index in a list.

ParameterTypeDescription
listlist
indexnumber

keys

keys(map) → list(string)

Return the keys of a map as a list.

ParameterTypeDescription
mapmap

length

length(collection) → number

Return the number of elements in a collection.

Works on lists, maps, and tuples. Use strlen for string length.

ParameterTypeDescription
collection`listmap

lookup

lookup(map, key, default) → any

Look up a key in a map with a default fallback.

ParameterTypeDescription
mapmap
keystring
defaultany

merge

merge(maps...) → map

Merge two or more maps. Later keys override earlier ones.

ParameterTypeDescription
maps...mapVariadic.

range

range(args...) → list(number)

Generate a list of numbers.

ParameterTypeDescription
args...numberVariadic.
range(3)

→ [0, 1, 2]

reverse

reverse(list) → list

Reverse the order of elements in a list.

ParameterTypeDescription
listlist

slice

slice(list, start, end) → list

Extract a contiguous sub-list.

ParameterTypeDescription
listlist
startnumber
endnumber

sort

sort(list) → list(string)

Sort a list of strings lexicographically.

ParameterTypeDescription
listlist(string)

values

values(map) → list

Return the values of a map as a list.

ParameterTypeDescription
mapmap

zipmap

zipmap(keys, values) → map

Construct a map from a list of keys and a list of values.

ParameterTypeDescription
keyslist(string)
valueslist