Skip to content

tuple_select_rangeTupleSelectRangeTupleSelectRangetuple_select_rangetuple_select_range🔗

Short description🔗

tuple_select_rangeTupleSelectRangeTupleSelectRangetuple_select_rangetuple_select_range — Select several elements of a tuple.

Signature🔗

tuple_select_range( tuple Tuple, integer Leftindex, integer Rightindex, out tuple Selected )void TupleSelectRange( const HTuple& Tuple, const HTuple& Leftindex, const HTuple& Rightindex, HTuple* Selected )static void HOperatorSet.TupleSelectRange( HTuple tuple, HTuple leftindex, HTuple rightindex, out HTuple selected )def tuple_select_range( tuple: MaybeSequence[Union[float, int, str]], leftindex: MaybeSequence[int], rightindex: MaybeSequence[int] ) -> Sequence[Union[float, int, str]]

def tuple_select_range_s( tuple: MaybeSequence[Union[float, int, str]], leftindex: MaybeSequence[int], rightindex: MaybeSequence[int] ) -> Union[float, int, str]Herror tuple_select_range( const Hlong Tuple, const Hlong Leftindex, const Hlong Rightindex, Hlong* Selected )

Herror T_tuple_select_range( const Htuple Tuple, const Htuple Leftindex, const Htuple Rightindex, Htuple* Selected )

HTuple HTuple::TupleSelectRange( const HTuple& Leftindex, const HTuple& Rightindex ) const

HTuple HTuple.TupleSelectRange( HTuple leftindex, HTuple rightindex )

Description🔗

tuple_select_rangeTupleSelectRange selects several consecutive elements of the input tuple Tupletupletuple and returns them with Selectedselectedselected. At this, Leftindexleftindexleftindex determines the index of the first element and Rightindexrightindexrightindex determines the index of the last element to select. Thus, both parameters Leftindexleftindexleftindex and Rightindexrightindexrightindex must contain a single integer value (any floating point number must represent an integer value without fraction). Indices of tuple elements start at 0, that means, the first tuple element has got the index 0. The result tuple Selectedselectedselected contains every element from the tuple Tupletupletuple that has got an index between Leftindexleftindexleftindex and Rightindexrightindexrightindex (including the elements at position Leftindexleftindexleftindex and Rightindexrightindexrightindex). If the indices are equal, only one element is selected. In addition, it is possible that the right index is Leftindexleftindexleftindex - 1. In this case and if the left or right index are valid an empty tuple is returned. Hence, the index Rightindexrightindexrightindex must be greater or equal to Leftindexleftindexleftindex - 1.

Exception: Empty input tuples🔗

If Leftindexleftindexleftindex and Rightindexrightindexrightindex are empty tuples, the operator returns an empty tuple. If only one of those parameters or Tupletupletuple is an empty tuple, an exception is raised.

HDevelop In-line Operation🔗

HDevelop provides an in-line operation for tuple_select_rangeTupleSelectRange, which can be used in an expression in the following syntax:

Selected := Tuple[Leftindex:Rightindex]

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.

Leftindexleftindexleftindex (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Index of first element to select.

Rightindexrightindexrightindex (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Index of last element to select.

Selectedselectedselected (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*)

Selected tuple elements.

Combinations with other operators🔗

Combinations

Alternatives

tuple_selectTupleSelect, tuple_first_nTupleFirstN, tuple_last_nTupleLastN, tuple_select_maskTupleSelectMask, tuple_str_bit_selectTupleStrBitSelect, tuple_concatTupleConcat, tuple_select_rankTupleSelectRank

See also

tuple_removeTupleRemove

Module🔗

Foundation