List Functions
Name(parameters) | Parameter Domain | Description | Example |
---|---|---|---|
list contains(list, element) |
list, any element of the semantic domain including null |
does the list contain the element? |
list contains([1,2,3], 2) = true |
count(list) |
list |
return size of list |
count([1,2,3]) = 3 |
minimum(list) |
(list of) comparable items |
return minimum item |
minimum([1,2,3]) = 1 |
maximum(list) |
(list of) comparable items |
return maximum item |
maximum([1,2,3]) = 3 |
sum(list) |
(list of) numbers |
return sum of numbers |
sum([1,2,3]) = 6 |
mean(list) |
(list of) numbers |
return arithmetic mean (average) of numbers |
mean([1,2,3]) = 2 |
sublist(list, start position, length?) |
list, number1, number2 |
return list of length (or all) elements of list, starting with list[start position]. 1st position is 1, last position is -1 |
sublist([1,2,3], 1, 2) = [2] |
append(list, item…) |
list, any element including null |
return new list with items appended |
append([1], 2, 3) = [1,2,3] |
concatenate(list…) |
list |
return new list that is a concatenation of the arguments |
concatenate([1,2],[3]) = [1,2,3] |
insert before(list, position, newItem) |
list, number1, any element including null |
return new list with newItem inserted at position |
insert before([1,3],1,2) = [1,2,3] |
remove(list, position) |
list, number1 |
list with item at position removed |
remove([1,2,3], 2) = [1,3] |
reverse(list) |
list |
reverse the list |
reverse([1,2,3]) = [3,2,1] |
index of(list, match) |
list, any element including null |
return ascending list of list positions containing match |
index of([1,2,3,2],2) = [2,4] |
union(list…) |
list |
concatenate with duplicate removal |
union([1,2],[2,3]) = [1,2,3] |
distinct values(list) |
list |
duplicate removal |
distinct values([1,2,3,2,1]) = [1,2,3] |
flatten(list) |
list |
flatten nested lists |
flatten([[1,2],[[3]], 4]) = [1,2,3,4] |