Skip to content

tuple_insertTupleInsertTupleInserttuple_insertT_tuple_insert🔗

Short description🔗

tuple_insertTupleInsertTupleInserttuple_insertT_tuple_insert — Inserts one or more elements into a tuple at index.

Signature🔗

tuple_insert( tuple Tuple, integer Index, tuple InsertTuple, out tuple Extended )void TupleInsert( const HTuple& Tuple, const HTuple& Index, const HTuple& InsertTuple, HTuple* Extended )static void HOperatorSet.TupleInsert( HTuple tuple, HTuple index, HTuple insertTuple, out HTuple extended )def tuple_insert( tuple: MaybeSequence[Union[float, int, str]], index: int, insert_tuple: MaybeSequence[Union[float, int, str]] ) -> Sequence[Union[float, int, str]]

Herror T_tuple_insert( const Htuple Tuple, const Htuple Index, const Htuple InsertTuple, Htuple* Extended )

HTuple HTuple::TupleInsert( const HTuple& Index, const HTuple& InsertTuple ) const

HTuple HTuple.TupleInsert( HTuple index, HTuple insertTuple )

Description🔗

tuple_insertTupleInsert inserts the elements of the tuple InsertTupleinsertTupleinsert_tuple at index into the tuple Tupletupletuple and returns them in the tuple Extendedextendedextended. In this context Indexindexindex determines the start index of the elements and InsertTupleinsertTupleinsert_tuple the values to insert. Successive values of Tupletupletuple will be positioned after the inserted values of InsertTupleinsertTupleinsert_tuple. The parameter Indexindexindex must contain a single integer value (any floating point number must represent an integer value without fraction). Indices of tuple elements start at 0. Therefore, the first tuple element has got the index 0. If Indexindexindex contains the length of Tupletupletuple as index, InsertTupleinsertTupleinsert_tuple will be appended. The length of the result tuple Extendedextendedextended is always the sum of the two input tuples Tupletupletuple and InsertTupleinsertTupleinsert_tuple. For example, if Tupletupletuple contains the values [0,1,0,1,0,1], the Indexindexindex contains the value [3] and the InsertTupleinsertTupleinsert_tuple contains the values [2,2,2], then the output tuple Extendedextendedextended will contain the values [0,1,0,2,2,2,1,0,1]. It is allowed to mix strings and numbers in the input tuples Tupletupletuple and InsertTupleinsertTupleinsert_tuple.

Exception: Empty input tuples🔗

If any of the input tuples is empty, an exception is raised.

HDevelop In-line Operation🔗

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

Extended := insert(Tuple, Index, InsertTuple)

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)

Start index of elements to be inserted.

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

Element(s) to insert at index.

Extendedextendedextended (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 with inserted elements.

Combinations with other operators🔗

Combinations

Alternatives

tuple_concatTupleConcat, tuple_replaceTupleReplace, tuple_gen_constTupleGenConst

See also

tuple_removeTupleRemove

Module🔗

Foundation