Skip to content

tuple_uniqTupleUniqTupleUniqtuple_uniqtuple_uniq🔗

Short description🔗

tuple_uniqTupleUniqTupleUniqtuple_uniqtuple_uniq — Discard all but one of successive identical elements of a tuple.

Signature🔗

tuple_uniq( tuple Tuple, out tuple Uniq )void TupleUniq( const HTuple& Tuple, HTuple* Uniq )static void HOperatorSet.TupleUniq( HTuple tuple, out HTuple uniq )def tuple_uniq( tuple: MaybeSequence[Union[float, int, str]] ) -> Sequence[Union[float, int, str]]

def tuple_uniq_s( tuple: MaybeSequence[Union[float, int, str]] ) -> Union[float, int, str]Herror tuple_uniq( const Hlong Tuple, Hlong* Uniq )

Herror T_tuple_uniq( const Htuple Tuple, Htuple* Uniq )

HTuple HTuple::TupleUniq( ) const

HTuple HTuple.TupleUniq( )

Description🔗

tuple_uniqTupleUniq discards all but one of successive identical elements from the input tuple Tupletupletuple and returns the remaining elements in Uniquniquniq. For example, if Tupletupletuple contains the values [0,0,1,1,1,2,0,1], the output tuple Uniquniquniq 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 Uniquniquniq that contains all different entries of Tupletupletuple exactly once, use the operator tuple_sortTupleSort first. Note however that in this case the output tuple Uniquniquniq 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_uniqTupleUniq, which can be used in an expression in the following syntax:

Uniq := uniq(Tuple)

As mentioned above, you can use tuple_sortTupleSort to truly get all unique elements of Tupletupletuple.

Uniq := uniq(sort(Tuple))

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Tupletupletuple (input_control) tuple(-array) → (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)MaybeSequence[Union[float, int, str]]Htuple (Hlong / double / char*)

Input tuple.

Uniquniquniq (output_control) tuple(-array) → (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)Sequence[Union[float, int, str]]Htuple (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)

Combinations with other operators🔗

Combinations

Possible predecessors

tuple_inverseTupleInverse, tuple_sortTupleSort

Alternatives

tuple_intersectionTupleIntersection

Module🔗

Foundation