Sfairadora

  • Reference Guide

insert

insert(seq, seq_elem)
insert(seq, pos, seq_elem)
var_seq <- insert(seq_elem)
var_seq <- insert(pos, seq_elem)
Inserts one or more elements to a sequence. If the parameter pos is specified, the elements are inserted to the position determined by the parameter, otherwise to the end. The first two variant of the function return the modified sequence, but the seq parameter itself is retained unchanged. The other two variants modify the sequence in place.

Parameters

seq
The sequence to be changed.
var_seq
An l-value of a sequence type, the value of which is to be changed.
pos
The position, where to insert (the type Int). The value 0 denotes the beginning of the sequence. If the parameter pos is a negative value or is beyond the sequence end, an error is returned.
seq_elem
An element or a sequence of elements to be inserted. If the parameter is of the same type as the element of the seq/var_seq sequence, only this single element is inserted. If it is of the same type as the sequence seq/var_seq, all its elements are inserted.

Return Value

The first two variants return the modified sequence, which is of the same type as the parameter seq.
The other two variants return l-value referring to the variable var_seq.

See Also