tuple_uniqtuple_uniqTupleUniqTupleUniqtuple_uniq (算子名称)
名称
tuple_uniqtuple_uniqTupleUniqTupleUniqtuple_uniq — Discard all but one of successive identical elements of a tuple.
参数签名
Herror tuple_uniq(const Hlong Tuple, Hlong* Uniq)
Herror T_tuple_uniq(const Htuple Tuple, 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]
描述
tuple_uniqtuple_uniqTupleUniqTupleUniqTupleUniqtuple_uniq discards all but one of successive identical
elements from the input tuple TupleTupleTupleTupletupletuple and returns the
remaining elements in UniqUniqUniqUniquniquniq.
For example, if TupleTupleTupleTupletupletuple contains the values
[0,0,1,1,1,2,0,1], the output tuple UniqUniqUniqUniquniquniq 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 UniqUniqUniqUniquniquniq that contains all different entries of
TupleTupleTupleTupletupletuple exactly once, use 该算子 tuple_sorttuple_sortTupleSortTupleSortTupleSorttuple_sort first. Note
however that in this case the output tuple UniqUniqUniqUniquniquniq is sorted.
The result of the above example then is [0,1,2].
Exception: Empty input tuple
If the input tuple is empty, 该算子 returns an empty tuple.
HDevelop In-line Operation
HDevelop provides an in-line operation for tuple_uniqtuple_uniqTupleUniqTupleUniqTupleUniqtuple_uniq,
which can be used in an expression in the following syntax:
Uniq := uniq(Tuple)
As mentioned above, you can use tuple_sorttuple_sortTupleSortTupleSortTupleSorttuple_sort to truly get all
unique elements of TupleTupleTupleTupletupletuple.
Uniq := uniq(sort(Tuple))
运行信息
- Multithreading type: independent (runs in parallel even with exclusive operators).
- 多线程作用域:全局(可以从任何线程调用)。
- 未经并行化处理。
参数表
TupleTupleTupleTupletupletuple (input_control) tuple(-array) → HTupleMaybeSequence[Union[float, int, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)
Input tuple.
UniqUniqUniqUniquniquniq (output_control) tuple(-array) → HTupleSequence[Union[float, int, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)
Tuple without successive identical elements.
例程 (HDevelop)
Tuple := [0,0,1,1,1,2,0,1]
*
tuple_uniq (Tuple, Uniq)
*
tuple_sort (Uniq, Sorted)
tuple_uniq (Sorted, Uniq1)
可能的前置算子
tuple_inversetuple_inverseTupleInverseTupleInverseTupleInversetuple_inverse,
tuple_sorttuple_sortTupleSortTupleSortTupleSorttuple_sort
可替代算子
tuple_intersectiontuple_intersectionTupleIntersectionTupleIntersectionTupleIntersectiontuple_intersection
模块
Foundation