Skip to content

Array Functions

Before going in note that any time VARNAME or FUNCNAME is written, it means a variable or function in the form Collection@Variable or a literal. Also note that most functions here also work with tuples, except min, max and sort

min

Syntax:

VARNAME1 = min(VARNAME2)
Returns the minimum value in VARNAME2 and assigns it to VARNAME1. VARNAME2 must be an array of numbers.

max

Syntax:

VARNAME1 = max(VARNAME2)
Returns the maximum value in VARNAME2 and assigns it to VARNAME1. VARNAME2 must be an array of numbers.

rfind

Syntax:

VARNAME1 = rfind(VARNAME2, VARNAME3)

Finds the first string in the array VARNAME2 that matches the regex pattern VARNAME3 and assigns it to VARNAME1. If no match is found, VARNAME1 is assigned an empty string. VARNAME2 must be an array of strings, and VARNAME3 must be a string representing a regex pattern.

rfindindex

Syntax:

VARNAME1 = rfindindex(VARNAME2, VARNAME3)

Finds the index of the first string in the array VARNAME2 that matches the regex pattern VARNAME3 and assigns it to VARNAME1. If no match is found, -1.0 is returned. VARNAME2 must be an array of strings, and VARNAME3 must be a string representing a regex pattern.

find

Syntax:

VARNAME1 = find(VARNAME2, VARNAME3)

Finds the index of the first string with the content VARNAME3 in the array VARNAME2 and assigns the result to VARNAME1. If no match is found an error is thrown. VARNAME2 must be an array of any type, and VARNAME3 must match that type.

get

Syntax:

VARNAME1 = get(VARNAME2, VARNAME3)

Gets the value at index VARNAME3 in the array VARNAME2 and assigns it to VARNAME1. If VARNAME3 is out of bounds, an error is thrown. VARNAME2 must be an array of any type, and VARNAME3 must be a number representing a valid index in VARNAME2.

length

Syntax:

VARNAME1 = len(VARNAME2)

Returns the length of the array VARNAME2 and assigns it to VARNAME1. VARNAME2 must be an array of any type.

append

Syntax:

VARNAME1 = append(VARNAME2, VARNAME3)

Clones the array VARNAME2 but with the value VARNAME3 added to the end and assigns it to VARNAME1. VARNAME2 must be an array of any type, and VARNAME3 must match that type.

sort

Syntax:

VARNAME1 = sort(VARNAME2)

Sorts array VARNAME2 and sets VARNAME1 to the result

slice

Syntax:

VARNAME1 = slice(VARNAME2, VARNAME3, VARNAME4)

Slices VARNAME2, giving a subarray of the elements from VARNAME3 to VARNAME4 and assigning the result to VARNAME1

count

Syntax:

VARNAME1 = countslice(VARNAME2, VARNAME3)

Counts the number of occurences in VARNAME2 of element VARNAME3, assinging the result to VARNAME1

reverse

Syntax:

VARNAME1 = reverse(VARNAME2)

Reverses the array VARNAME2 and sets VARNAME1 to the result

set

Syntax:

VARNAME1 = set(VARNAME2, VARNAME3, VARNAME4)

Sets the value of VARNAME2 at index VARNAME3 to the value VARNAME4

insert

Syntax:

VARNAME1 = insert(VARNAME2, VARNAME3, VARNAME4)

Inserts the value VARNAME4 into VARNAME2 at index VARNAME3

range

Syntax:

VARNAME1 = range(VARNAME2, VARNAME3, VARNAME4)

Creates an array with numbers VARNAME2 to VARNAME3 with a step size of VARNAME4