Skip to main content

Functions

abs

If the given number is negative then returns its positive equivalent, or otherwise returns the given number unchanged.

abs(num)
ParameterTypeDescription
numnumber

can

can(expression)
ParameterTypeDescription
expressionexpression closure

ceil

Returns the smallest whole number that is greater than or equal to the given value.

ceil(num)
ParameterTypeDescription
numnumber

chomp

Removes one or more newline characters from the end of the given string.

chomp(str)
ParameterTypeDescription
strstring

chunklist

Splits a single list into multiple lists where each has at most the given number of elements.

chunklist(list, size)
ParameterTypeDescription
listlist of dynamicThe list to split into chunks.
sizenumberThe maximum length of each chunk. All but the last element of the result is guaranteed to be of exactly this size.

coalescelist

Returns the first of the given sequences that has a length greater than zero.

coalescelist(…vals)
ParameterTypeDescription
valsdynamicList or tuple values to test in the given order.

compact

Removes all empty string elements from the given list of strings.

compact(list)
ParameterTypeDescription
listlist of string

concat

Concatenates together all of the given lists or tuples into a single sequence, preserving the input order.

concat(…seqs)
ParameterTypeDescription
seqsdynamic

contains

Returns true if the given value is a value in the given list, tuple, or set, or false otherwise.

contains(list, value)
ParameterTypeDescription
listdynamic
valuedynamic

csvdecode

Parses the given string as Comma Separated Values (as defined by RFC 4180) and returns a map of objects representing the table of data, using the first row as a header row to define the object attributes.

csvdecode(str)
ParameterTypeDescription
strstring

distinct

Removes any duplicate values from the given list, preserving the order of remaining elements.

distinct(list)
ParameterTypeDescription
listlist of dynamic

element

Returns the element with the given index from the given list or tuple, applying the modulo operation to the given index if it's greater than the number of elements.

element(list, index)
ParameterTypeDescription
listdynamic
indexnumber

endswith

endswith(s, suffix)
ParameterTypeDescription
sstring
suffixstring

flatten

Transforms a list, set, or tuple value into a tuple by replacing any given elements that are themselves sequences with a flattened tuple of all of the nested elements concatenated together.

flatten(list)
ParameterTypeDescription
listdynamic

floor

Returns the greatest whole number that is less than or equal to the given value.

floor(num)
ParameterTypeDescription
numnumber

format

Constructs a string by applying formatting verbs to a series of arguments, using a similar syntax to the C function "printf".

format(format, …args)
ParameterTypeDescription
formatstring
argsdynamic

formatdate

Formats a timestamp given in RFC 3339 syntax into another timestamp in some other machine-oriented time syntax, as described in the format string.

formatdate(format, time)
ParameterTypeDescription
formatstring
timestring

formatlist

Constructs a list of strings by applying formatting verbs to a series of arguments, using a similar syntax to the C function "printf".

formatlist(format, …args)
ParameterTypeDescription
formatstring
argsdynamic

indent

Adds a given number of spaces after each newline character in the given string.

indent(spaces, str)
ParameterTypeDescription
spacesnumberNumber of spaces to add after each newline character.
strstringThe string to transform.

index

Returns the element with the given key from the given collection, or raises an error if there is no such element.

index(collection, key)
ParameterTypeDescription
collectiondynamic
keydynamic

join

Concatenates together the elements of all given lists with a delimiter, producing a single string.

join(separator, …lists)
ParameterTypeDescription
separatorstringDelimiter to insert between the given strings.
listslist of stringOne or more lists of strings to join.

jsondecode

Parses the given string as JSON and returns a value corresponding to what the JSON document describes.

jsondecode(str)
ParameterTypeDescription
strstring

jsonencode

Returns a string containing a JSON representation of the given value.

jsonencode(val)
ParameterTypeDescription
valdynamic

keys

Returns a list of the keys of the given map in lexicographical order.

keys(inputMap)
ParameterTypeDescription
inputMapdynamicThe map to extract keys from. May instead be an object-typed value, in which case the result is a tuple of the object attributes.

length

Returns the number of elements in the given collection.

length(collection)
ParameterTypeDescription
collectiondynamic

list

list(elem_type)
ParameterTypeDescription
elem_typetype

log

Returns the logarithm of the given number in the given base.

log(num, base)
ParameterTypeDescription
numnumber
basenumber

lower

Returns the given string with all Unicode letters translated to their lowercase equivalents.

lower(str)
ParameterTypeDescription
strstring

map

map(elem_type)
ParameterTypeDescription
elem_typetype

max

Returns the numerically greatest of all of the given numbers.

max(…numbers)
ParameterTypeDescription
numbersnumber

merge

Merges all of the elements from the given maps into a single map, or the attributes from given objects into a single object.

merge(…maps)
ParameterTypeDescription
mapsdynamic

min

Returns the numerically smallest of all of the given numbers.

min(…numbers)
ParameterTypeDescription
numbersnumber

object

object(attr_type)
ParameterTypeDescription
attr_typemap of type

parseint

Parses the given string as a number of the given base, or raises an error if the string contains invalid characters.

parseint(number, base)
ParameterTypeDescription
numberdynamic
basenumber

pow

Returns the given number raised to the given power (exponentiation).

pow(num, power)
ParameterTypeDescription
numnumber
powernumber

print

print prints the value to stdout, and returns the value.

print(print)
ParameterTypeDescription
printdynamic

range

Returns a list of numbers spread evenly over a particular range.

range(…params)
ParameterTypeDescription
paramsnumber

regex

Applies the given regular expression pattern to the given string and returns information about a single match, or raises an error if there is no match.

regex(pattern, string)
ParameterTypeDescription
patternstring
stringstring

regexall

Applies the given regular expression pattern to the given string and returns a list of information about all non-overlapping matches, or an empty list if there are no matches.

regexall(pattern, string)
ParameterTypeDescription
patternstring
stringstring

regexpescape

Return a string that escapes all regular expression metacharacters in the provided text.

regexpescape(str)
ParameterTypeDescription
strstring

regexreplace

Applies the given regular expression pattern to the given string and replaces all matches with the given replacement string.

regexreplace(str, pattern, replace)
ParameterTypeDescription
strstring
patternstring
replacestring

replace

Replaces all instances of the given substring in the given string with the given replacement string.

replace(str, substr, replace)
ParameterTypeDescription
strstringThe string to search within.
substrstringThe substring to search for.
replacestringThe new substring to replace substr with.

reverse

Returns the given list with its elements in reverse order.

reverse(list)
ParameterTypeDescription
listdynamic

set

set(elem_type)
ParameterTypeDescription
elem_typetype

setintersection

Returns the intersection of all given sets.

setintersection(first_set, …other_sets)
ParameterTypeDescription
first_setset of dynamic
other_setsset of dynamic

setproduct

Calculates the cartesian product of two or more sets.

setproduct(…sets)
ParameterTypeDescription
setsdynamicThe sets to consider. Also accepts lists and tuples, and if all arguments are of list or tuple type then the result will preserve the input ordering

setsubtract

Returns the relative complement of the two given sets.

setsubtract(a, b)
ParameterTypeDescription
aset of dynamic
bset of dynamic

setunion

Returns the union of all given sets.

setunion(first_set, …other_sets)
ParameterTypeDescription
first_setset of dynamic
other_setsset of dynamic

signum

Returns 0 if the given number is zero, 1 if the given number is positive, or -1 if the given number is negative.

signum(num)
ParameterTypeDescription
numnumber

slice

Extracts a subslice of the given list or tuple value.

slice(list, start_index, end_index)
ParameterTypeDescription
listdynamic
start_indexnumber
end_indexnumber

sort

Applies a lexicographic sort to the elements of the given list.

sort(list)
ParameterTypeDescription
listlist of string

split

Produces a list of one or more strings by splitting the given string at all instances of a given separator substring.

split(separator, str)
ParameterTypeDescription
separatorstringThe substring that delimits the result strings.
strstringThe string to split.

sql

sql is a stub function for raw expressions.

sql(def)
ParameterTypeDescription
defstring

startswith

startswith(s, prefix)
ParameterTypeDescription
sstring
prefixstring

strrev

Returns the given string with all of its Unicode characters in reverse order.

strrev(str)
ParameterTypeDescription
strstring

substr

Extracts a substring from the given string.

substr(str, offset, length)
ParameterTypeDescription
strstringThe input string.
offsetnumberThe starting offset in Unicode characters.
lengthnumberThe maximum length of the result in Unicode characters.

timeadd

Adds the duration represented by the given duration string to the given RFC 3339 timestamp string, returning another RFC 3339 timestamp.

timeadd(timestamp, duration)
ParameterTypeDescription
timestampstring
durationstring

title

Replaces one letter after each non-letter and non-digit character with its uppercase equivalent.

title(str)
ParameterTypeDescription
strstring

tobool

tobool(v)
ParameterTypeDescription
vdynamic

tolist

tolist(v)
ParameterTypeDescription
vdynamic

tonumber

tonumber(v)
ParameterTypeDescription
vdynamic

toset

toset(v)
ParameterTypeDescription
vdynamic

tostring

tostring(v)
ParameterTypeDescription
vdynamic

trim

Removes consecutive sequences of characters in "cutset" from the start and end of the given string.

trim(str, cutset)
ParameterTypeDescription
strstringThe string to trim.
cutsetstringA string containing all of the characters to trim. Each character is taken separately, so the order of characters is insignificant.

trimprefix

Removes the given prefix from the start of the given string, if present.

trimprefix(str, prefix)
ParameterTypeDescription
strstringThe string to trim.
prefixstringThe prefix to remove, if present.

trimspace

Removes any consecutive space characters (as defined by Unicode) from the start and end of the given string.

trimspace(str)
ParameterTypeDescription
strstring

trimsuffix

Removes the given suffix from the start of the given string, if present.

trimsuffix(str, suffix)
ParameterTypeDescription
strstringThe string to trim.
suffixstringThe suffix to remove, if present.

try

try(…expressions)
ParameterTypeDescription
expressionsexpression closure

tuple

tuple(elem_type)
ParameterTypeDescription
elem_typelist of type

upper

Returns the given string with all Unicode letters translated to their uppercase equivalents.

upper(str)
ParameterTypeDescription
strstring

urlescape

urlescape escapes the string so it can be safely placed inside a URL query.

urlescape(string)
ParameterTypeDescription
stringstring

urlqueryset

urlqueryset sets the query parameter for the URL.

urlqueryset(url, key, value)
ParameterTypeDescription
urlstring
keystring
valuestring

urlsetpath

urlsetpath sets the path for the URL.

urlsetpath(url, path)
ParameterTypeDescription
urlstring
pathstring

urluserinfo

urluserinfo sets the user for the URL.

urluserinfo(url, user, …pass)
ParameterTypeDescription
urlstring
userstring
passstring

values

Returns the values of elements of a given map, or the values of attributes of a given object, in lexicographic order by key or attribute name.

values(mapping)
ParameterTypeDescription
mappingdynamic

zipmap

Constructs a map from a list of keys and a corresponding list of values, which must both be of the same length.

zipmap(keys, values)
ParameterTypeDescription
keyslist of string
valuesdynamic