Skip to content

tuple_first_nTupleFirstNTupleFirstNtuple_first_ntuple_first_nšŸ”—

Short descriptionšŸ”—

tuple_first_nTupleFirstNTupleFirstNtuple_first_ntuple_first_n — Select the first elements of a tuple up to the index ā€œnā€.

SignaturešŸ”—

tuple_first_n( tuple Tuple, integer Index, out tuple Selected )void TupleFirstN( const HTuple& Tuple, const HTuple& Index, HTuple* Selected )static void HOperatorSet.TupleFirstN( HTuple tuple, HTuple index, out HTuple selected )def tuple_first_n( tuple: MaybeSequence[Union[float, int, str]], index: int ) -> Sequence[Union[float, int, str]]

def tuple_first_n_s( tuple: MaybeSequence[Union[float, int, str]], index: int ) -> Union[float, int, str]Herror tuple_first_n( const Hlong Tuple, const Hlong Index, Hlong* Selected )

Herror T_tuple_first_n( const Htuple Tuple, const Htuple Index, Htuple* Selected )

HTuple HTuple::TupleFirstN( const HTuple& Index ) const

HTuple HTuple.TupleFirstN( HTuple index )

DescriptionšŸ”—

tuple_first_nTupleFirstN selects the first elements of Tupletupletuple up to the index Indexindexindex and returns them in Selectedselectedselected. Indices of tuple elements start at 0, that means, the first tuple element has got the index 0. In total, Indexindexindex+1 elements are returned.

Indexindexindex must contain a single integer value (or a floating point number that represents an integer value without fraction).

Exception: Empty input tuplešŸ”—

If Tupletupletuple is empty, an exception is raised.

HDevelop In-line OperationšŸ”—

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

Selected := firstn(Tuple, Index)

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.

Indexindexindex (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Index of the 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_last_nTupleLastN, tuple_selectTupleSelect, tuple_str_bit_selectTupleStrBitSelect, tuple_concatTupleConcat, tuple_select_maskTupleSelectMask

See also

tuple_removeTupleRemove

ModulešŸ”—

Foundation