tuple_uniqtuple_uniqTupleUniqTupleUniq (Operator)
Name
tuple_uniqtuple_uniqTupleUniqTupleUniq
— Discard all but one of successive identical elements of a tuple.
Signature
Herror tuple_uniq(const Hlong Tuple, Hlong* Uniq)
Herror T_tuple_uniq(const Htuple Tuple, Htuple* Uniq)
Description
tuple_uniqtuple_uniqTupleUniqTupleUniqTupleUniq
discards all but one of successive identical
elements from the input tuple TupleTupleTupleTupletuple
and returns the
remaining elements in UniqUniqUniqUniquniq
.
For example, if TupleTupleTupleTupletuple
contains the values
[0,0,1,1,1,2,0,1], the output tuple UniqUniqUniqUniquniq
will contain
the values [0,1,2,0,1]. It is allowed to mix strings and numbers in the
input tuple.
To get a tuple UniqUniqUniqUniquniq
that contains all different entries of
TupleTupleTupleTupletuple
exactly once, use the operator tuple_sorttuple_sortTupleSortTupleSortTupleSort
first. Note
however that in this case the output tuple UniqUniqUniqUniquniq
is sorted.
The result of the above example then is [0,1,2].
Exception: Empty input tuple
If the input tuple is empty, the operator returns an empty tuple.
HDevelop In-line Operation
HDevelop provides an in-line operation for tuple_uniqtuple_uniqTupleUniqTupleUniqTupleUniq
,
which can be used in an expression in the following syntax:
Uniq := uniq(Tuple)
As mentioned above, you can use tuple_sorttuple_sortTupleSortTupleSortTupleSort
to truly get all
unique elements of TupleTupleTupleTupletuple
.
Uniq := uniq(sort(Tuple))
Execution Information
- Multithreading type: independent (runs in parallel even with exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
TupleTupleTupleTupletuple
(input_control) tuple(-array) →
HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)
Input tuple.
UniqUniqUniqUniquniq
(output_control) tuple(-array) →
HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)
Tuple without successive identical elements.
Example (HDevelop)
Tuple := [0,0,1,1,1,2,0,1]
*
tuple_uniq (Tuple, Uniq)
*
tuple_sort (Uniq, Sorted)
tuple_uniq (Sorted, Uniq1)
Possible Predecessors
tuple_inversetuple_inverseTupleInverseTupleInverseTupleInverse
,
tuple_sorttuple_sortTupleSortTupleSortTupleSort
Alternatives
tuple_intersectiontuple_intersectionTupleIntersectionTupleIntersectionTupleIntersection
Module
Foundation