ClassesClasses | | Operators

tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRange (Operator)

Name

tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRange — Select several elements of a tuple.

Signature

tuple_select_range( : : Tuple, Leftindex, Rightindex : Selected)

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)

void TupleSelectRange(const HTuple& Tuple, const HTuple& Leftindex, const HTuple& Rightindex, HTuple* Selected)

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

static void HOperatorSet.TupleSelectRange(HTuple tuple, HTuple leftindex, HTuple rightindex, out HTuple selected)

HTuple HTuple.TupleSelectRange(HTuple leftindex, HTuple rightindex)

Description

tuple_select_rangetuple_select_rangeTupleSelectRangeTupleSelectRangeTupleSelectRange selects several consecutive elements of the input tuple TupleTupleTupleTupletuple and returns them with SelectedSelectedSelectedSelectedselected. At this, LeftindexLeftindexLeftindexLeftindexleftindex determines the index of the first element and RightindexRightindexRightindexRightindexrightindex determines the index of the last element to select. Thus, both parameters LeftindexLeftindexLeftindexLeftindexleftindex and RightindexRightindexRightindexRightindexrightindex 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 SelectedSelectedSelectedSelectedselected contains every element from the tuple TupleTupleTupleTupletuple that has got an index between LeftindexLeftindexLeftindexLeftindexleftindex and RightindexRightindexRightindexRightindexrightindex (including the elements at position LeftindexLeftindexLeftindexLeftindexleftindex and RightindexRightindexRightindexRightindexrightindex). If the indices are equal, only one element is selected. In addition, it is possible that the right index is LeftindexLeftindexLeftindexLeftindexleftindex - 1. In this case and if the left or right index are valid an empty tuple is returned. Hence, the index RightindexRightindexRightindexRightindexrightindex must be greater or equal to LeftindexLeftindexLeftindexLeftindexleftindex - 1.

Exception: Empty input tuples

If LeftindexLeftindexLeftindexLeftindexleftindex and RightindexRightindexRightindexRightindexrightindex are empty tuples, the operator returns an empty tuple. If only one of those parameters or TupleTupleTupleTupletuple is an empty tuple, an exception is raised.

HDevelop In-line Operation

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

Selected := Tuple[Leftindex:Rightindex]

Execution Information

Parameters

TupleTupleTupleTupletuple (input_control)  number(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Input tuple.

LeftindexLeftindexLeftindexLeftindexleftindex (input_control)  number(-array) HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Index of first element to select.

RightindexRightindexRightindexRightindexrightindex (input_control)  number(-array) HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Index of last element to select.

SelectedSelectedSelectedSelectedselected (output_control)  number(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

Selected tuple elements.

Alternatives

tuple_selecttuple_selectTupleSelectTupleSelectTupleSelect, tuple_first_ntuple_first_nTupleFirstNTupleFirstNTupleFirstN, tuple_last_ntuple_last_nTupleLastNTupleLastNTupleLastN, tuple_select_masktuple_select_maskTupleSelectMaskTupleSelectMaskTupleSelectMask, tuple_str_bit_selecttuple_str_bit_selectTupleStrBitSelectTupleStrBitSelectTupleStrBitSelect, tuple_concattuple_concatTupleConcatTupleConcatTupleConcat, tuple_select_ranktuple_select_rankTupleSelectRankTupleSelectRankTupleSelectRank

See also

tuple_removetuple_removeTupleRemoveTupleRemoveTupleRemove

Module

Foundation


ClassesClasses | | Operators