Collections
Build, reshape and query lists, maps and objects.
concat
concat(lists...) → listConcatenate two or more lists into one.
| Parameter | Type | Description |
|---|---|---|
lists... | list | Variadic. |
concat(["a"], ["b", "c"])→ ["a", "b", "c"]
contains
contains(list, value) → boolCheck whether a list or set contains a given value.
| Parameter | Type | Description |
|---|---|---|
list | list | |
value | any |
distinct
distinct(list) → listRemove duplicate elements from a list.
| Parameter | Type | Description |
|---|---|---|
list | list |
element
element(list, index) → anyReturn the element at the given index in a list.
| Parameter | Type | Description |
|---|---|---|
list | list | |
index | number |
keys
keys(map) → list(string)Return the keys of a map as a list.
| Parameter | Type | Description |
|---|---|---|
map | map |
length
length(collection) → numberReturn the number of elements in a collection.
Works on lists, maps, and tuples. Use strlen for string length.
| Parameter | Type | Description |
|---|---|---|
collection | `list | map |
lookup
lookup(map, key, default) → anyLook up a key in a map with a default fallback.
| Parameter | Type | Description |
|---|---|---|
map | map | |
key | string | |
default | any |
merge
merge(maps...) → mapMerge two or more maps. Later keys override earlier ones.
| Parameter | Type | Description |
|---|---|---|
maps... | map | Variadic. |
range
range(args...) → list(number)Generate a list of numbers.
| Parameter | Type | Description |
|---|---|---|
args... | number | Variadic. |
range(3)→ [0, 1, 2]
reverse
reverse(list) → listReverse the order of elements in a list.
| Parameter | Type | Description |
|---|---|---|
list | list |
slice
slice(list, start, end) → listExtract a contiguous sub-list.
| Parameter | Type | Description |
|---|---|---|
list | list | |
start | number | |
end | number |
sort
sort(list) → list(string)Sort a list of strings lexicographically.
| Parameter | Type | Description |
|---|---|---|
list | list(string) |
values
values(map) → listReturn the values of a map as a list.
| Parameter | Type | Description |
|---|---|---|
map | map |
zipmap
zipmap(keys, values) → mapConstruct a map from a list of keys and a list of values.
| Parameter | Type | Description |
|---|---|---|
keys | list(string) | |
values | list |