C++ Native Functions: spl.collection
SPL standard and specialized toolkits > spl 1.2.1 > spl.collection > C++ Native Functions
- public void appendM (mutable blob b, list<uint8> bytes)
Append to blob.
- Parameters
-
- b
-
Blob to be appended to.
- bytes
-
List of bytes to be appended.
- public void appendM (mutable blob b, uint8 byte)
Append to 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 list (mutating version).
- Parameters
-
- values
-
List to be appended to.
- value
-
Value to be appended.
- <any T> public list<T> at (list<T> values, list<uint32> idxs)
Multi-element access.
- Parameters
-
- values
-
List of input values.
- idxs
-
List of selector indexes.
- Returns
-
A new list of values at the indexes the specified by the selectors.
- <any T>[N] public list<T> at (list<T>[N] values, list<uint32> idxs)
Multi-element access.
- Parameters
-
- values
-
List of input values.
- idxs
-
List of selector indexes.
- Returns
-
A new list of values at the indexes the 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 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 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 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 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 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 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 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 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 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 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 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 sets (mutating version).
- Parameters
-
- values1
-
Set to be appended to.
- values2
-
Set to be appended.
- <any T> public int32 countDistinct (list<T> values)
Compute distinct count of a list.
- Parameters
-
- values
-
Input values.
- Returns
-
Number of distinct values.
- <any T>[N] public int32 countDistinct (list<T>[N] values)
Compute distinct count of a list.
- Parameters
-
- values
-
Input values.
- Returns
-
Number of distinct values.
- <any T> public list<int32> find (list<T> values, T item)
Find matching values in a list.
- Parameters
-
- values
-
List of values.
- item
-
Value to be found.
- Returns
-
List of indexes at which input value list have a matching item.
- <any T>[N] public list<int32> find (list<T>[N] values, T item)
Find matching values in a list.
- Parameters
-
- values
-
List of values.
- item
-
Value to be found.
- Returns
-
List of indexes at which input value list have a matching item.
- <any T> public int32 findFirst (list<T> values, T item)
Find the first occurrence of a matching value in a list, 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.
- 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, 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.
- 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 value sequence in a list, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first item of the first match (-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 value sequence in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Index of the first item to be considered.
- Returns
-
Index of the first item of the first match (-1, if no match).
- <any T> public int32 findFirst(list<T> values, list<T> items)
Find the first occurrence of a matching value sequence in a list, starting at index 0.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
Index of the first item of the first match (-1, if no match).
- <any T> public int32 findFirst(list<T> values, list<T> items, int32 sidx)
Find the first occurrence of a matching value sequence in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- sidx
-
Index of the first item to be considered.
- Returns
-
Index of the first item of the first match (-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, 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.
- 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, 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.
- 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, 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.
- 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, 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.
- 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, 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.
- 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, 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.
- 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, 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.
- 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, 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.
- 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.
- 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 value sequence in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the first item of the last match (-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.
- 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 value sequence in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- lidx
-
Index of the last item to be considered.
- Returns
-
Index of the first item of the last match (-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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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 non-matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have a non-matching item.
- <any T>[N] public list<int32> findNotOf (list<T> values, list<T>[N] items)
Find non-matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have a non-matching item.
- <any T>[N] public list<int32> findNotOf (list<T>[N] values, list<T> items)
Find non-matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have a non-matching item.
- <any T>[N,M] public list<int32> findNotOf (list<T>[N] values, list<T>[M] items)
Find non-matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have a non-matching item.
- <any T> public list<int32> findOf (list<T> values, list<T> items)
Find matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have a matching item.
- <any T>[N] public list<int32> findOf (list<T> values, list<T>[N] items)
Find matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have a matching item.
- <any T>[N] public list<int32> findOf (list<T>[N] values, list<T> items)
Find matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have a matching item.
- <any T>[N,M] public list<int32> findOf (list<T>[N] values, list<T>[M] items)
Find matching values in a list.
- Parameters
-
- values
-
List of input values.
- items
-
List of search values.
- Returns
-
List of indexes at which input value list have 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 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 ival 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 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 ival 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 key/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 key/value inserted.
- <any V> public set<V> insert (set<V> values, V value)
Insert into a set.
- Parameters
-
- values
-
Input set.
- value
-
New value.
- Returns
-
A copy of the set with value inserted.
- <any V>[N] public set<V>[N] insert (set<V>[N] values, V value)
Insert into a set.
- Parameters
-
- values
-
Input set.
- value
-
New value.
- Returns
-
A copy of the set with value inserted.
- <any T> public void insertM (mutable list<T> values, T ival, int32 idx)
Insert 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 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 into a set (mutating version).
- Parameters
-
- values
-
Input set.
- value
-
New value.
- <any V>[N] public void insertM (mutable set<V>[N] values, V value)
Insert into a set (mutating version).
- Parameters
-
- values
-
Input set.
- value
-
New value.
- <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 that when used in a for loop to iterate over the map, the keys function is optimized to an iterator 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 is left in an undefined state.
- 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 that when used in a for loop to iterate over the map, the keys function is optimized to an iterator 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 is left in an undefined state.
- 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.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of search values.
- Returns
-
-1 of 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.
- Parameters
-
- values1
-
First list of input values.
- values2
-
Second list of search values.
- Returns
-
-1 of 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 element-wise, with scalar.
- 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 element-wise, with scalar.
- 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 element-wise, with scalar.
- 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 - element-wise.
- Parameters
-
- a
-
List of values.
- b
-
List of value 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 element-wise, with scalar.
- 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 element-wise.
- Parameters
-
- a
-
List of values.
- b
-
List of value 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 and fetch the larger - element-wise.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of large values from corresponding locations.
- <ordered T>[N] public list<T>[N] pairwiseMax (list<T>[N] a, list<T>[N] b)
Compare and fetch the larger - element-wise.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of large values from corresponding locations.
- <ordered T> public list<T> pairwiseMin (list<T> a, list<T> b)
Compare and fetch the smaller - element-wise.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of small values from corresponding locations.
- <ordered T>[N] public list<T>[N] pairwiseMin (list<T>[N] a, list<T>[N] b)
Compare and fetch the smaller - element-wise.
- Parameters
-
- a
-
First list.
- b
-
Second list.
- Returns
-
List of small values from 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. If an exception is thrown, the operator calling this function terminates.
- <list T> public T remove (T values, int32 idx)
Remove values 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 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 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 key removed.
- <any K> public set<K> remove (set<K> values, K key)
Return a set with a key removed.
- Parameters
-
- values
-
Input set.
- key
-
Key of value to be removed.
- Returns
-
A copy of the set with key removed.
- <any K>[N] public set<K>[N] remove (set<K>[N] values, K key)
Return a set with a key removed.
- Parameters
-
- values
-
Input set.
- key
-
Key of value to be removed.
- Returns
-
A copy of the set with key removed.
- <list T> public void removeM (mutable T values, int32 idx)
Remove values 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 K from a set (mutating version).
- Parameters
-
- values
-
Input set.
- key
-
Key to be removed.
- <any K>[N] public void removeM (mutable set<K>[N] values, K key)
Remove K from a set (mutating version).
- Parameters
-
- values
-
Input set.
- key
-
Key to be removed.
- <list T> public T reverse (T values)
Reverse 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 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 ('true' means list a).
- a
-
First list.
- b
-
Second list.
- Returns
-
A new list of values selected from list a or b.
- Throws
-
- SPLRuntimeInvalidArgumentException
-
If sizes are not the same. If an exception is thrown, the operator calling this function terminates.
- <set T> public T setDifference (T a, T b)
Compute set difference.
- 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 set intersection.
- 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 set union.
- 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 list - extract items from the 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 list - extract items from the 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. If an exception is thrown, the operator calling this function terminates.
- <list T> public T slice (T values, int32 from, int32 cnt, int32 skip, int32 tape)
Slice list - extract items from the 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. If an exception is thrown, the operator calling this function terminates.
- <ordered T> public list<T> sort (list<T> values)
Sort values.
- Parameters
-
- values
-
List of input values.
- Returns
-
A copy of the list with sorted input values, in increasing order.
- <ordered T>[N] public list<T>[N] sort (list<T>[N] values)
Sort values.
- Parameters
-
- values
-
List of input values.
- Returns
-
A copy of the list with sorted input values, in increasing order.
- <ordered T> public list<uint32> sortIndices (list<T> values)
Sort values and return indexes.
- Parameters
-
- values
-
List of input values.
- Returns
-
A new list of indexes of sorted items.
- <ordered T>[N] public list<uint32> sortIndices (list<T>[N] values)
Sort values and return indexes.
- Parameters
-
- values
-
List of input values.
- Returns
-
A new list of indexes of sorted items.
- <ordered T> public void sortM (mutable list<T> values)
Sort values (mutating version).
- Parameters
-
- values
-
List of input values.
- <ordered T>[N] public void sortM (mutable list<T>[N] values)
Sort values (mutating version).
- Parameters
-
- values
-
List of input values.
- <any T> public set<T> toSet (list<T> values)
Convert a list to a set.
- Parameters
-
- values
-
Input values.
- Returns
-
A new set with 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
-
Input values.
- Returns
-
A new set with the values from the list.