List of built-ins

Pattern Description
fmt x: any Transform any object into a string that represents it. Use this pattern to interpolate non-string values with string values in order to create more complex displays, e.g., "there are " + fmt 4 + " lights". Without the fmt, you will get a type error.
len x: [any] | {any} | text Gets the length of a list, a dictionary or a string.
range [start, end] Generates a list of consecutive integer numbers from start to end - 1.
zip [left, right] Iterates through both iterables at the same time, returning a list with the pairs of elements in the same position. For example, zip [[1, 2, 3], [4, 5, 6]] yields [[1, 4], [2, 5], [3, 6]].
enumerate x: [any] | {any} Generates a list of indexed value for a list. For example, enumerate ["a", "b", "c"] yields [[1, "a"], [2, "b"], [3, "c"]].
sum x: [number] Returns the sum of all numbers in a list.
max x: [number] Returns the maximum of all numbers in a list.
min x: [number] Returns the minimum of all numbers in a list.
all x: [bool] Returns true if there is no false in the list.
any x: [bool] Returns false if there is no true in the list.
sort x: [number] | [text] Returns a sorted version of a list.
keys x: {any} Returns the a list of the keys in the dictionary.
values x: {any} Returns the a list of the values in the dictionary.
split sep: text Returns the a pattern that splits a text by the supplied separator. Use it like so: ( split "," ) "a,b,c" = ["a", "b", "c"]
join sep: text Returns the a pattern that joins a list of text with the supplied separator. Use it like so: ( join "," ) ["a", "b", "c"] = "a,b,c"
trim x: text Returns a text with all leading and trailing whitespaces removed.
trim_start x: text Returns a text with all leading whitespaces removed.
trim_end x: text Returns a text with all trailing whitespaces removed.
starts_with prefix: text Returns a pattern that tests if a text starts with the given prefix. Use it like so: ( starts_with "foo" ) "foobar" = true
ends_with postfix: text Returns a pattern that tests if a text ends with the given postfix. Use it like so: ( ends_with "bar" ) "foobar" = true
lowercase x: text Makes all letters lowercase.
uppercase x: text Makes all letters uppercase.
replace [find: text, subst: text] Returns a pattern that substitutes all occurrences of the text find with the text subst. Use it like so: ( replace [ "five", "four" ] ) "There are five lights" = "There are four lights"
parse_int x: text Parses some text as int, e.gparse_int "123" = 123. This raises an error if the text is not a valid integer.
parse_float x: text Parses some text as float, e.gparse_float "123" = 123.0. This raises an error if the text is not a valid float.
floor x: float Calculates the floor of a given number.
ceil x: float Calculates the ceiling of a given number.
round x: float Rounds a given number to the nearest integer.