C++ Native Functions: spl.collection
- public void appendM (mutable blob b, list<uint8> bytes)
-
Append a list of bytes to a blob.
- Parameters
-
- b
-
Blob to be appended to.
- bytes
-
List of bytes to be appended.
- public void appendM (mutable blob b, uint8 byte)
-
Append a byte to a blob.
- Parameters
-
- b
-
Blob to be appended to.
- byte
-
Byte to be appended.
- <any T> public void appendM (mutable list<T> values, T value)
-
Append to a list (mutating version).
- Parameters
-
- values
-
List to be appended to.
- value
-
Value to be appended.
- <any T>[N] public void appendM (mutable list<T>[N] values, T value)
-
Append to a bounded list (mutating version). If the list is already at its maximum size, it will not be changed.
- Parameters
-
- values
-
List to be appended to.
- value
-
Value to be appended.
- <any T> public list<T> at (list<T> values, list<uint32> idxs)
-
Access multiple elements of a list.
- Parameters
-
- values
-
List of input values.
- idxs
-
List of selector indexes.
- Returns
-
A new list of values at the indexes specified by the selectors.
- <any T>[N] public list<T> at (list<T>[N] values, list<uint32> idxs)
-
Access multiple elements of a list.
- Parameters
-
- values
-
List of input values.
- idxs
-
List of selector indexes.
- Returns
-
A new list of values at the indexes specified by the selectors.
- public uint64 blobSize (blob b)
-
Get the size of a blob.
- Parameters
-
- b
-
Input blob.
- Returns
-
Number of bytes in the blob.
- <collection T> public void clearM (mutable T values)
-
Clear (empty) a list.
- Parameters
-
- values
-
Input list.
- public void clearM (mutable blob values)
-
Clear (empty) a list.
- Parameters
-
- values
-
Input list.
- <any T> public list<T> concat (list<T> values1, list<T> values2)
-
Concatenate two lists.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of input values.
- Returns
-
A new, combined list of values containing, in order, values in the first list, followed by the values in the second list.
- <any T>[N] public list<T> concat (list<T> values1, list<T>[N] values2)
-
Concatenate two lists.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of input values.
- Returns
-
A new, combined list of values containing, in order, values in the first list, followed by the values in the second list.
- <any T>[N] public list<T> concat (list<T>[N] values1, list<T> values2)
-
Concatenate two lists.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of input values.
- Returns
-
A new, combined list of values containing, in order, values in the first list, followed by the values in the second list.
- <any T>[N,M] public list<T> concat (list<T>[N] values1, list<T>[M] values2)
-
Concatenate two lists.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of input values.
- Returns
-
A new, combined list of values containing, in order, values in the first list, followed by the values in the second list.
- <any T> public void concatM (mutable list<T> values1, list<T> values2)
-
Concatenate two lists (mutating version). Append the list values2 to the list values1.
- Parameters
-
- values1
-
List to be appended to.
- values2
-
List to be appended.
- <any T>[N] public void concatM (mutable list<T> values1, list<T>[N] values2)
-
Concatenate two lists (mutating version). Append the list values2 to the list values1.
- Parameters
-
- values1
-
List to be appended to.
- values2
-
List to be appended.
- <any T>[N] public void concatM (mutable list<T>[N] values1, list<T> values2)
-
Concatenate two lists (mutating version). Append the list values2 to the list values1.
- Parameters
-
- values1
-
List to be appended to.
- values2
-
List to be appended.
- <any T>[N,M] public void concatM (mutable list<T>[N] values1, list<T>[M] values2)
-
Concatenate two lists (mutating version). Append the list values2 to the list values1.
- Parameters
-
- values1
-
List to be appended to.
- values2
-
List to be appended.
- <any T> public void concatM (mutable set<T> values1, set<T> values2)
-
Concatenate two sets (mutating version).
- Parameters
-
- values1
-
Set to be appended to.
- values2
-
Set to be appended.
- <any T>[N] public void concatM (mutable set<T> values1, set<T>[N] values2)
-
Concatenate two sets (mutating version).
- Parameters
-
- values1
-
Set to be appended to.
- values2
-
Set to be appended.
- <any T>[N] public void concatM (mutable set<T>[N] values1, set<T> values2)
-
Concatenate two sets (mutating version).
- Parameters
-
- values1
-
Set to be appended to.
- values2
-
Set to be appended.
- <any T>[N,M] public void concatM (mutable set<T>[N] values1, set<T>[M] values2)
-
Concatenate two sets (mutating version).
- Parameters
-
- values1
-
Set to be appended to.
- values2
-
Set to be appended.
- <any T> public int32 countDistinct (list<T> values)
-
Compute the distinct count of a list.
- Parameters
-
- values
-
List of input values.
- Returns
-
Number of distinct values in the list.
- <any T>[N] public int32 countDistinct (list<T>[N] values)
-
Compute the distinct count of a list.
- Parameters
-
- values
-
List of input values.
- Returns
-
Number of distinct values in the list.
- <any T> public list<int32> find (list<T> values, T item)
-
Find the matching values in a list, given a value to search for.
- Parameters
-
- values
-
List of values.
- item
-
Value to be found.
- Returns
-
List of indexes at each of which the input list has a matching item.
- <any T>[N] public list<int32> find (list<T>[N] values, T item)
-
Find the matching values in a list, given a value to search for.
- Parameters
-
- values
-
List of values.
- item
-
Value to be found.
- Returns
-
List of indexes at each of which the input list has a matching item.
- <any T> public int32 findFirst (list<T> values, T item)
-
Find the first occurrence of a matching value in a list, given a value to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- item
-
Search value.
- Returns
-
Index of the first match (-1, if no match).
- <any T> public int32 findFirst (list<T> values, T item, int32 sidx)
-
Find the first occurrence of a matching value in a list, given a value to search for.
- Parameters
-
- values
-
List of input values.
- item
-
Search value.
- sidx
-
Start index of the search.
- Returns
-
Index of the first match (-1, if no match).
- <any T>[N] public int32 findFirst (list<T>[N] values, T item)
-
Find the first occurrence of a matching value in a list, given a value to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- item
-
Search value.
- Returns
-
Index of the first match (-1, if no match).
- <any T>[N] public int32 findFirst (list<T>[N] values, T item, int32 sidx)
-
Find the first occurrence of a matching value in a list, given a value to search for.
- Parameters
-
- values
-
List of input values.
- item
-
Search value.
- sidx
-
Start index of the search.
- Returns
-
Index of the first match (-1, if no match).
- <any T>[N,M] public int32 findFirst (list<T>[N] values, list<T>[M] items)
-
Find the first occurrence of a matching sequence of values in a list, starting at index 0.
- Parameters
-
- values
-
List of input values to be searched.
- items
-
List containing a sequence of values to be matched as a sequence.
- Returns
-
Index of the first item of the first match in the list to be searched (-1, if no match).
- <any T>[N,M] public int32 findFirst (list<T>[N] values, list<T>[M] items, int32 sidx)
-
Find the first occurrence of a matching sequence of values in a list.
- Parameters
-
- values
-
List of input values to be searched.
- items
-
List containing a sequence of values to be matched as a sequence.
- sidx
-
Index of the first item to be considered in the list to be searched.
- Returns
-
Index of the first item of the first match in the list to be searched (-1, if no match).
- <any T> public int32 findFirst(list<T> values, list<T> items)
-
Find the first occurrence of a matching sequence of values in a list, starting at index 0.
- Parameters
-
- values
-
List of input values to be searched.
- items
-
List containing a sequence of values to be matched as a sequence.
- Returns
-
Index of the first item of the first match in the list to be searched (-1, if no match).
- <any T> public int32 findFirst(list<T> values, list<T> items, int32 sidx)
-
Find the first occurrence of a matching sequence of values in a list.
- Parameters
-
- values
-
List of input values to be searched.
- items
-
List containing a sequence of values to be matched as a sequence.
- sidx
-
Index of the first item to be considered in the list to be searched.
- Returns
-
Index of the first item of the first match in the list to be searched (-1, if no match).
- <any T> public int32 findFirstNotOf (list<T> values, list<T> items)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T> public int32 findFirstNotOf (list<T> values, list<T> items, int32 sidx)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstNotOf (list<T> values, list<T>[N] items)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstNotOf (list<T> values, list<T>[N] items, int32 sidx)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstNotOf (list<T>[N] values, list<T> items)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstNotOf (list<T>[N] values, list<T> items, int32 sidx)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T>[N,M] public int32 findFirstNotOf (list<T>[N] values, list<T>[M] items)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T>[N,M] public int32 findFirstNotOf (list<T>[N] values, list<T>[M] items, int32 sidx)
-
Find the first occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that does not match any of the values in the search list (-1, if no match).
- <any T> public int32 findFirstOf (list<T> values, list<T> items)
-
Find the first occurrence of a matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T> public int32 findFirstOf (list<T> values, list<T> items, int32 sidx)
-
Find the first occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstOf (list<T> values, list<T>[N] items)
-
Find the first occurrence of a matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstOf (list<T> values, list<T>[N] items, int32 sidx)
-
Find the first occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstOf (list<T>[N] values, list<T> items)
-
Find the first occurrence of a matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T>[N] public int32 findFirstOf (list<T>[N] values, list<T> items, int32 sidx)
-
Find the first occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T>[N,M] public int32 findFirstOf (list<T>[N] values, list<T>[M] items)
-
Find the first occurrence of a matching value in a list, given a list of values to search for, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T>[N,M] public int32 findFirstOf (list<T>[N] values, list<T>[M] items, int32 sidx)
-
Find the first occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Start index of the search.
- Returns
-
Index of the first value that matches one of the values in the search list (-1, if no match).
- <any T> public int32 findLast (list<T> values, T item, int32 lidx)
-
Find the last occurrence of a matching value in a list, given a value to search for.
- Parameters
-
- values
-
List of input values.
- item
-
Search value.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last match (-1, if no match).
- <any T> public int32 findLast (list<T> values, list<T> items, int32 lidx)
-
Find the last occurrence of a matching sequence of values in a list.
- Parameters
-
- values
-
List of input values to be searched.
- items
-
List containing a sequence of values to be matched as a sequence.
- lidx
-
Index of the last item to be considered in the list to be searched.
- Returns
-
Index of the first item of the last match in the list to be searched (-1, if no match).
- <any T>[N] public int32 findLast (list<T>[N] values, T item, int32 lidx)
-
Find the last occurrence of a matching value in a list, given a value to search for.
- Parameters
-
- values
-
List of input values.
- item
-
Search value.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last match (-1, if no match).
- <any T>[N,M] public int32 findLast (list<T>[N] values, list<T>[M] items, int32 lidx)
-
Find the last occurrence of a matching sequence of values in a list.
- Parameters
-
- values
-
List of input values to be searched.
- items
-
List containing a sequence of values to be matched as a sequence.
- lidx
-
Index of the last item to be considered in the list to be searched.
- Returns
-
Index of the first item of the last match in the list to be searched (-1, if no match).
- <any T> public int32 findLastNotOf (list<T> values, list<T> items, int32 lidx)
-
Find the last occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that does not match any of the values in the search list (-1, if no match).
- <any T>[N] public int32 findLastNotOf (list<T> values, list<T>[N] items, int32 lidx)
-
Find the last occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that does not match any of the values in the search list (-1, if no match).
- <any T>[N] public int32 findLastNotOf (list<T>[N] values, list<T> items, int32 lidx)
-
Find the last occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that does not match any of the values in the search list (-1, if no match).
- <any T>[N,M] public int32 findLastNotOf (list<T>[N] values, list<T>[M] items, int32 lidx)
-
Find the last occurrence of a non-matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that does not match any of the values in the search list (-1, if no match).
- <any T> public int32 findLastOf (list<T> values, list<T> items, int32 lidx)
-
Find the last occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that matches one of the values in the search list (-1, if no match).
- <any T>[N] public int32 findLastOf (list<T> values, list<T>[N] items, int32 lidx)
-
Find the last occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that matches one of the values in the search list (-1, if no match).
- <any T>[N] public int32 findLastOf (list<T>[N] values, list<T> items, int32 lidx)
-
Find the last occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that matches one of the values in the search list (-1, if no match).
- <any T>[N,M] public int32 findLastOf (list<T>[N] values, list<T>[M] items, int32 lidx)
-
Find the last occurrence of a matching value in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the last value that matches one of the values in the search list (-1, if no match).
- <any T> public list<int32> findNotOf (list<T> values, list<T> items)
-
Find the non-matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a non-matching item.
- <any T>[N] public list<int32> findNotOf (list<T> values, list<T>[N] items)
-
Find the non-matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a non-matching item.
- <any T>[N] public list<int32> findNotOf (list<T>[N] values, list<T> items)
-
Find the non-matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a non-matching item.
- <any T>[N,M] public list<int32> findNotOf (list<T>[N] values, list<T>[M] items)
-
Find the non-matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a non-matching item.
- <any T> public list<int32> findOf (list<T> values, list<T> items)
-
Find the matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a matching item.
- <any T>[N] public list<int32> findOf (list<T> values, list<T>[N] items)
-
Find the matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a matching item.
- <any T>[N] public list<int32> findOf (list<T>[N] values, list<T> items)
-
Find the matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a matching item.
- <any T>[N,M] public list<int32> findOf (list<T>[N] values, list<T>[M] items)
-
Find the matching values in a list, given a list of values to search for.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at each of which the input list has a matching item.
- <any T> public boolean has (list<T> values, T item)
-
Find whether a given value exists in a list.
- Parameters
-
- values
-
List of input values.
- item
-
Value to be found.
- Returns
-
The result 'true' if the list contains the searched value, 'false' otherwise.
- <any T>[N] public boolean has (list<T>[N] values, T item)
-
Find whether a given value exists in a list.
- Parameters
-
- values
-
List of input values.
- item
-
Value to be found.
- Returns
-
The result 'true' if the list contains the searched value, 'false' otherwise.
- <any K, any V> public boolean has (map<K,V> values, K item)
-
Find whether a given key exists in a map.
- Parameters
-
- values
-
Map of key-value pairs.
- item
-
Key to be found.
- Returns
-
The result 'true' if the map contains the searched key, 'false' otherwise.
- <any K, any V>[N] public boolean has (map<K,V>[N] values, K item)
-
Find whether a given key exists in a map.
- Parameters
-
- values
-
Map of key-value pairs.
- item
-
Key to be found.
- Returns
-
The result 'true' if the map contains the searched key, 'false' otherwise.
- <any T> public boolean has (set<T> values, T item)
-
Find whether a given value exists in a set.
- Parameters
-
- values
-
Set of input values.
- item
-
Value to be found.
- Returns
-
The result 'true' if the set contains the searched value, 'false' otherwise.
- <any T>[N] public boolean has (set<T>[N] values, T item)
-
Find whether a given value exists in a set.
- Parameters
-
- values
-
Set of input values.
- item
-
Value to be found.
- Returns
-
The result 'true' if the set contains the searched value, 'false' otherwise.
- <any T> public list<T> insert (list<T> values, T ival, int32 idx)
-
Insert a value into a list.
- Parameters
-
- values
-
List of input values.
- ival
-
Value to be inserted.
- idx
-
Index of the insert position.
- Returns
-
A new list of values with the new value inserted.
- <any T> public list<T> insert (list<T> values, list<T> ivls, int32 idx)
-
Insert a list of values into a list.
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- Returns
-
A new list of values with the new values inserted.
- <any T>[N] public list<T> insert (list<T> values, list<T>[N] ivls, int32 idx)
-
Insert a list of values into a list.
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- Returns
-
A new list of values with the new values inserted.
- <any T>[N] public list<T>[N] insert (list<T>[N] values, T ival, int32 idx)
-
Insert a value into a list.
- Parameters
-
- values
-
List of input values.
- ival
-
Value to be inserted.
- idx
-
Index of the insert position.
- Returns
-
A new list of values with the new value inserted.
- <any T>[N] public list<T>[N] insert (list<T>[N] values, list<T> ivls, int32 idx)
-
Insert a list of values into a list.
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- Returns
-
A new list of values with the new values inserted.
- <any T>[N,M] public list<T>[N] insert (list<T>[N] values, list<T>[M] ivls, int32 idx)
-
Insert a list of values into a list.
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- Returns
-
A new list of values with the new values inserted.
- <any K, any V> public map<K,V> insert (map<K,V> values, K key, V value)
-
Insert an element into a map.
- Parameters
-
- values
-
Input map.
- key
-
New key value.
- value
-
New value.
- Returns
-
New map with an element mapping the key to the value inserted.
- <any K, any V>[N] public map<K,V>[N] insert (map<K,V>[N] values, K key, V value)
-
Insert an element into a map.
- Parameters
-
- values
-
Input map.
- key
-
New key value.
- value
-
New value.
- Returns
-
New map with an element mapping the key to the value inserted.
- <any V> public set<V> insert (set<V> values, V value)
-
Insert a value into a set.
- Parameters
-
- values
-
Input set.
- value
-
Value to be inserted.
- Returns
-
A copy of the set with the value inserted.
- <any V>[N] public set<V>[N] insert (set<V>[N] values, V value)
-
Insert a value into a set.
- Parameters
-
- values
-
Input set.
- value
-
Value to be inserted.
- Returns
-
A copy of the set with the value inserted.
- <any T> public void insertM (mutable list<T> values, T ival, int32 idx)
-
Insert a value into a list (mutating version).
- Parameters
-
- values
-
List of input values.
- ival
-
Value to be inserted.
- idx
-
Index of the insert position.
- <any T> public void insertM (mutable list<T> values, list<T> ivls, int32 idx)
-
Insert values into a list (mutating version).
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- <any T>[N] public void insertM (mutable list<T> values, list<T>[N] ivls, int32 idx)
-
Insert values into a list (mutating version).
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- <any T>[N] public void insertM (mutable list<T>[N] values, T ival, int32 idx)
-
Insert a value into a list (mutating version).
- Parameters
-
- values
-
List of input values.
- ival
-
Value to be inserted.
- idx
-
Index of the insert position.
- <any T>[N] public void insertM (mutable list<T>[N] values, list<T> ivls, int32 idx)
-
Insert values into a list (mutating version).
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- <any T>[N,M] public void insertM (mutable list<T>[N] values, list<T>[M] ivls, int32 idx)
-
Insert values into a list (mutating version).
- Parameters
-
- values
-
List of input values.
- ivls
-
List of values to be inserted.
- idx
-
Index of the insert position.
- <any K, any V> public void insertM (mutable map<K,V> values, K key, V value)
-
Insert an element into a map (mutating version).
- Parameters
-
- values
-
Input map.
- key
-
New key value.
- value
-
New value.
- <any K, any V>[N] public void insertM (mutable map<K,V>[N] values, K key, V value)
-
Insert an element into a map (mutating version).
- Parameters
-
- values
-
Input map.
- key
-
New key value.
- value
-
New value.
- <any V> public void insertM (mutable set<V> values, V value)
-
Insert a value into a set (mutating version).
- Parameters
-
- values
-
Input set.
- value
-
Value to be inserted into the input set.
- <any V>[N] public void insertM (mutable set<V>[N] values, V value)
-
Insert a value into a set (mutating version).
- Parameters
-
- values
-
Input set.
- value
-
Value to be inserted into the input set.
- <any K, any V> public list<K> keys (map<K,V> m)
-
Return a list of the keys in the given map. The order of the keys in the returned list is undefined.
Note: When used in a for loop to iterate over the map, the keys function is optimized to iterate over the map. No elements should be added or removed from the map within the body of the for loop when using this function as the iterator.
- Parameters
-
- m
-
Input map.
- Returns
-
A list of the keys from the map.
- <any K, any V>[N] public list<K> keys (map<K,V>[N] m)
-
Return a list of the keys in the given map. The order of the keys in the returned list is undefined.
Note: When used in a for loop to iterate over the map, the keys function is optimized to iterate over the map. No elements should be added or removed from the map within the body of the for loop when using this function as the iterator.
- Parameters
-
- m
-
Input map.
- Returns
-
A list of the keys from the map.
- <ordered T> public int32 lexicographicalCompare(list<T> values1, list<T> values2)
-
Compare two lists in lexicographical order.
A list is less if a value at the same index in both lists is less, or if the list has matching values, but is shorter than the other list.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of input values.
- Returns
-
-1 if the first list is less that the second, 0 if they are equal, and 1 if the first list is greater than the second.
- <ordered T>[N,M] public int32 lexicographicalCompare(list<T>[N] values1, list<T>[M] values2)
-
Compare two lists in lexicographical order.
A list is less if a value at the same index in both lists is less, or if the list has matching values, but is shorter than the other list.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of input values.
- Returns
-
-1 if the first list is less that the second, 0 if they are equal, and 1 if the first list is greater than the second.
- <numeric T> public list<T> makeSequence (T val, int32 cnt)
-
Make a sequence.
- Parameters
-
- val
-
Input value.
- cnt
-
Sequence length.
- Returns
-
A list of values that start with the input value and increase by one at each step.
- <string T> public list<T> makeSequence (T val, int32 cnt)
-
Make a sequence.
- Parameters
-
- val
-
Input value.
- cnt
-
Sequence length.
- Returns
-
A sequence of strings, where each string starts with the input value and has an index value appended at the end (index starts from 0).
- <numeric T> public list<T> makeSequence (T val, int32 cnt, T step)
-
Make a sequence.
- Parameters
-
- val
-
Input value.
- cnt
-
Sequence length.
- step
-
Step increase.
- Returns
-
A list of values that start with the input value val and increase by a given step.
- <ordered T> public list<int32> pairwiseCompare (T a, list<T> b)
-
Compare a list, element-wise, with a scalar value.
- Parameters
-
- a
-
Value to compare against.
- b
-
List of values.
- Returns
-
List of comparison results, 1 if the element from the list is smaller, 0 if they are equal, and -1 if the element from the list is larger.
- <ordered T>[N] public list<int32>[N] pairwiseCompare (T a, list<T>[N] b)
-
Compare a list, element-wise, with a scalar value.
- Parameters
-
- a
-
Value to compare against.
- b
-
List of values.
- Returns
-
List of comparison results, 1 if the element from the list is smaller, 0 if they are equal, and -1 if the element from the list is larger.
- <ordered T> public list<int32> pairwiseCompare (list<T> a, T b)
-
Compare a list, element-wise, with a scalar value.
- Parameters
-
- a
-
List of values.
- b
-
Value to compare against.
- Returns
-
List of comparison results, -1 if the element from the list is smaller, 0 if they are equal, and 1 if the element from the list is larger.
- <ordered T> public list<int32> pairwiseCompare (list<T> a, list<T> b)
-
Compare two lists, element-wise, up to the end of the shorter list, or of both lists if they are of equal length.
- Parameters
-
- a
-
First list of values.
- b
-
List of values to compare against.
- Returns
-
List of comparison results, -1 if the element from the first list is smaller, 0 if they are equal, and 1 if the element from the first list is larger.
- <ordered T>[N] public list<int32>[N] pairwiseCompare (list<T>[N] a, T b)
-
Compare a list, element-wise, with a scalar value.
- Parameters
-
- a
-
List of values.
- b
-
Value to compare against.
- Returns
-
List of comparison results, -1 if the element from the list is smaller, 0 if they are equal, and 1 if the element from the list is larger.
- <ordered T>[N] public list<int32>[N] pairwiseCompare (list<T>[N] a, list<T>[N] b)
-
Compare two lists, element-wise, up to the end of the shorter list, or of both lists if they are of equal length.
- Parameters
-
- a
-
First list of values.
- b
-
List of values to compare against.
- Returns
-
List of comparison results, -1 if the element from the first list is smaller, 0 if they are equal, and 1 if the element from the first list is larger.
- <ordered T> public list<T> pairwiseMax (list<T> a, list<T> b)
-
Compare two lists, element-wise, and fetch the larger or equal value, up to the end of the shorter list, or of both lists if they are of equal length.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of the larger or equal of the two values from the corresponding locations.
- <ordered T>[N] public list<T>[N] pairwiseMax (list<T>[N] a, list<T>[N] b)
-
Compare two lists, element-wise, and fetch the larger or equal value, up to the end of the shorter list, or of both lists if they are of equal length.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of the larger or equal of the two values from the corresponding locations.
- <ordered T> public list<T> pairwiseMin (list<T> a, list<T> b)
-
Compare two lists, element-wise, and fetch the smaller or equal value, up to the end of the shorter list, or of both lists if they are of equal length.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of the smaller or equal of the two values from the corresponding locations.
- <ordered T>[N] public list<T>[N] pairwiseMin (list<T>[N] a, list<T>[N] b)
-
Compare two lists, element-wise, and fetch the smaller or equal value, up to the end of the shorter list, or of both lists if they are of equal length.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of the smaller or equal of the two values from the corresponding locations.
- <list T> public list<int32> range (T l)
-
Return a list of values in the range from 0 to size(l)-1
Note: This is optimized by the SPL compiler to avoid creating the list in: for (int32 i in range(myList)).
- Parameters
-
- l
-
List to be used for index generation.
- Returns
-
A list of int32 values from 0 to size(l)-1.
- public list<int32> range (int32 limit)
-
Return a list of values in the range from 0 to limit-1
Note: An empty list is returned if limit <= 0.
Note: This is optimized by the SPL compiler to avoid creating the list in: for (int32 i in range(u)).
- Parameters
-
- limit
-
Upper bound of range to be returned, exclusive.
- Returns
-
A list of int32 values from 0 to limit-1.
- public list<int32> range (int32 start, int32 limit)
-
Return a list of values in the range from start to limit-1
Note: An empty list is returned if limit <= start.
Note: This is optimized by the SPL compiler to avoid creating the list in: for (int32 i in range(l,u)).
- Parameters
-
- start
-
Lower bound of range to be returned.
- limit
-
Upper bound of range to be returned, exclusive.
- Returns
-
A list of int32 values from start to limit-1.
- public list<int32> range (int32 start, int32 limit, int32 step)
-
Return a list of values in the range from start to limit-1, with an increment of step
Note: An empty list is returned if limit <= start for positive step or limit >= start for negative step.
Note: This is optimized by the SPL compiler to avoid creating the list in: for (int32 i in range(l,u,s)).
- Parameters
-
- start
-
Lower bound of range to be returned.
- limit
-
Upper bound of range to be returned, exclusive.
- step
-
Increment from start to limit.
- Returns
-
A list of int32 values from start to limit-1 incrementing by step.
- Throws
-
- SPLRuntimeInvalidArgumentException
-
If step is zero.
- <list T> public T remove (T values, int32 idx)
-
Remove a value from a list.
- Parameters
-
- values
-
List of input values.
- idx
-
Index of the item to be removed.
- Returns
-
A copy of the list of values after the removal.
- <list T> public T remove (T values, int32 sidx, int32 eidx)
-
Remove values from a list using a range.
- Parameters
-
- values
-
List of input values.
- sidx
-
Start index of the removal range.
- eidx
-
End index of the removal range (inclusive).
- Returns
-
A copy of the list of values with the range of values removed.
- <list T> public T remove (T values, list<int32> idxs)
-
Remove values from a list using an index list.
- Parameters
-
- values
-
List of input values.
- idxs
-
List of removal indexes.
- Returns
-
A copy of the list of values with the specified values removed.
- <any K, any V> public map<K,V> remove (map<K,V> values, K key)
-
Remove an element from a map.
- Parameters
-
- values
-
Input map.
- key
-
Key of value to be removed.
- Returns
-
A copy of the map with the key removed.
- <any K, any V>[N] public map<K,V>[N] remove (map<K,V>[N] values, K key)
-
Remove an element from a map.
- Parameters
-
- values
-
Input map.
- key
-
Key of value to be removed.
- Returns
-
A copy of the map with the key removed.
- <any K> public set<K> remove (set<K> values, K key)
-
Return a set with a value removed.
- Parameters
-
- values
-
Input set.
- key
-
Value to be removed.
- Returns
-
A copy of the set with the value removed.
- <any K>[N] public set<K>[N] remove (set<K>[N] values, K key)
-
Return a set with a value removed.
- Parameters
-
- values
-
Input set.
- key
-
Value to be removed.
- Returns
-
A copy of the set with the value removed.
- <list T> public void removeM (mutable T values, int32 idx)
-
Remove a value from a list (mutating version).
- Parameters
-
- values
-
List of input values.
- idx
-
Index of the item to be removed.
- <list T> public void removeM (mutable T values, int32 sidx, int32 eidx)
-
Remove values from a list using a range (mutating version).
- Parameters
-
- values
-
List of input values.
- sidx
-
Start index of the removal range.
- eidx
-
End index of the removal range (inclusive).
- <any K, any V> public void removeM (mutable map<K,V> values, K key)
-
Remove an element from a map (mutating version).
- Parameters
-
- values
-
Input map.
- key
-
Key of value to be removed.
- <any K, any V>[N] public void removeM (mutable map<K,V>[N] values, K key)
-
Remove an element from a map (mutating version).
- Parameters
-
- values
-
Input map.
- key
-
Key of value to be removed.
- <any K> public void removeM (mutable set<K> values, K key)
-
Remove a value from a set (mutating version).
- Parameters
-
- values
-
Input set.
- key
-
Value to be removed.
- <any K>[N] public void removeM (mutable set<K>[N] values, K key)
-
Remove a value from a set (mutating version).
- Parameters
-
- values
-
Input set.
- key
-
Value to be removed.
- <list T> public T reverse (T values)
-
Reverse a list of values.
- Parameters
-
- values
-
List of input values.
- Returns
-
A copy of the list with the values in reverse order.
- <list T> public void reverseM (mutable T values)
-
Reverse a list of values (mutating version).
- Parameters
-
- values
-
List to be reversed.
- <list T> public T selectFromList (list<boolean> selector, T a, T b)
-
Select element-wise from two lists.
- Parameters
-
- selector
-
List of booleans where 'true' means select from the first list, and 'false' means select from the second list.
- a
-
First list.
- b
-
Second list.
- Returns
-
A new list of values, each selected from either the first or the second list.
- Throws
-
- SPLRuntimeInvalidArgumentException
-
If the sizes of the two lists are not the same.
- <set T> public T setDifference (T a, T b)
-
Compute the difference of two sets.
- Parameters
-
- a
-
First set (of type SPL::set or SPL::bset).
- b
-
Second set (of type SPL::set or SPL::bset).
- Returns
-
A new set containing the elements in a that are not in b.
- <set T> public T setIntersection (T a, T b)
-
Compute the intersection of two sets.
- Parameters
-
- a
-
First set (of type SPL::set or SPL::bset).
- b
-
Second set (of type SPL::set or SPL::bset).
- Returns
-
A new set containing the elements in both a and b.
- <set T> public T setUnion (T a, T b)
-
Compute the union of two sets.
- Parameters
-
- a
-
First set (of type SPL::set or SPL::bset).
- b
-
Second set (of type SPL::set or SPL::bset).
- Returns
-
A new set containing the elements in either a and b.
- <collection T> public int32 size (T values)
-
Get the size of a list.
- Parameters
-
- values
-
Input list.
- Returns
-
Number of items in the list.
- public int32 size (blob values)
-
Get the size of a list.
- Parameters
-
- values
-
Input list.
- Returns
-
Number of items in the list.
- <list T> public T slice (T values, int32 from, int32 cnt)
-
Slice a list: extract items from a list.
- Parameters
-
- values
-
List of input values.
- from
-
Start index of the extraction.
- cnt
-
Number of values to be extracted.
- Returns
-
List of extracted input values.
- <list T> public T slice (T values, int32 from, int32 cnt, int32 skip)
-
Slice a list: extract items from a list.
- Parameters
-
- values
-
List of input values.
- from
-
Start index of the extraction.
- cnt
-
Number of values to be extracted.
- skip
-
Number of values to be skipped after each extraction (should be >=0).
- Returns
-
List of extracted input values.
- Throws
-
- SPLRuntimeInvalidArgumentException
-
If skip is negative.
- <list T> public T slice (T values, int32 from, int32 cnt, int32 skip, int32 tape)
-
Slice a list: extract items from a list.
- Parameters
-
- values
-
List of input values.
- from
-
Start index of the extraction.
- cnt
-
Number of slices to be extracted.
- skip
-
Number of values to be skipped after each slice (should be >=0).
- tape
-
Number of values to be extracted after the first item in a slice, i.e., slice size - 1 (should be >=0).
- Returns
-
List of extracted input values.
- Throws
-
- SPLRuntimeInvalidArgumentException
-
If skip or tape is negative.
- <ordered T> public list<T> sort (list<T> values)
-
Sort a list of values.
- Parameters
-
- values
-
List of values.
- Returns
-
A copy of the list with values sorted in increasing order.
- <ordered T>[N] public list<T>[N] sort (list<T>[N] values)
-
Sort a list of values.
- Parameters
-
- values
-
List of values.
- Returns
-
A copy of the list with values sorted in increasing order.
- <ordered T> public list<uint32> sortIndices (list<T> values)
-
Sort a list of values and return a list of indexes that specify the values in sorted order.
- Parameters
-
- values
-
List of input values.
- Returns
-
A new list containing indexes to the items that specify the items in sorted order.
- <ordered T>[N] public list<uint32> sortIndices (list<T>[N] values)
-
Sort a list of values and return a list of indexes that specify the values in sorted order.
- Parameters
-
- values
-
List of input values.
- Returns
-
A new list containing indexes to the items that specify the items in sorted order.
- <ordered T> public void sortM (mutable list<T> values)
-
Sort a list of values (mutating version).
- Parameters
-
- values
-
List of values to be sorted.
- <ordered T>[N] public void sortM (mutable list<T>[N] values)
-
Sort a list of values (mutating version).
- Parameters
-
- values
-
List of values to be sorted.
- <any T> public set<T> toSet (list<T> values)
-
Convert a list to a set.
- Parameters
-
- values
-
List of input values.
- Returns
-
A new set containing the values from the list.
- <any T>[N] public set<T>[N] toSet (list<T>[N] values)
-
Convert a list to a set.
- Parameters
-
- values
-
List of input values.
- Returns
-
A new set containing the values from the list.