tuple_repeat_elemtuple_repeat_elemTupleRepeatElemTupleRepeatElemtuple_repeat_elem (Operator)

Name

tuple_repeat_elemtuple_repeat_elemTupleRepeatElemTupleRepeatElemtuple_repeat_elem — Repeat the elements of a tuple.

Signature

tuple_repeat_elem( : : Tuple, Num : Result)

Herror tuple_repeat_elem(const Hlong Tuple, const Hlong Num, Hlong* Result)

Herror T_tuple_repeat_elem(const Htuple Tuple, const Htuple Num, Htuple* Result)

void TupleRepeatElem(const HTuple& Tuple, const HTuple& Num, HTuple* Result)

HTuple HTuple::TupleRepeatElem(const HTuple& Num) const

static void HOperatorSet.TupleRepeatElem(HTuple tuple, HTuple num, out HTuple result)

HTuple HTuple.TupleRepeatElem(HTuple num)

def tuple_repeat_elem(tuple: HTupleType, num: Union[int, float]) -> Sequence[HTupleElementType]

def tuple_repeat_elem_s(tuple: HTupleType, num: Union[int, float]) -> HTupleElementType

Description

tuple_repeat_elemtuple_repeat_elemTupleRepeatElemTupleRepeatElemtuple_repeat_elem repeats each element of TupleTupleTupletupletuple NumNumNumnumnum times and returns them with ResultResultResultresultresult. Thus, ResultResultResultresultresult contains NumNumNumnumnum times more elements than TupleTupleTupletupletuple. For example, the first NumNumNumnumnum elements of ResultResultResultresultresult are equal to the first element of TupleTupleTupletupletuple. NumNumNumnumnum must be positive and integer (also for type real). If NumNumNumnumnum is equal to 0, an empty tuple is returned.

Exception: Empty input tuple

If the input tuple is empty, the operator returns an empty tuple.

HDevelop In-line Operation

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

Result := rep_elem(Tuple, Num)

Execution Information

Parameters

TupleTupleTupletupletuple (input_control)  tuple(-array) HTupleHTupleTypeHTupleHtuple (integer / real / string / handle) (int / long / double / string / HHandle) (Hlong / double / HString / HHandle) (Hlong / double / char* / handle)

Input tuple.

NumNumNumnumnum (input_control)  integer HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Number of repetitions.

ResultResultResultresultresult (output_control)  tuple(-array) HTupleSequence[HTupleElementType]HTupleHtuple (integer / real / string / handle) (int / long / double / string / HHandle) (Hlong / double / HString / HHandle) (Hlong / double / char* / handle)

Tuple with repeated elements.

Example (HDevelop)

tuple_repeat_elem (['a', 'b', 'c'], 2, Result)
* Returns ['a', 'a', 'b', 'b', 'c', 'c']

Alternatives

tuple_concattuple_concatTupleConcatTupleConcattuple_concat, tuple_gen_consttuple_gen_constTupleGenConstTupleGenConsttuple_gen_const

See also

tuple_repeattuple_repeatTupleRepeatTupleRepeattuple_repeat

Module

Foundation