Algosim documentation: insert

insert

Inserts a new element into a linear container.

Syntax

Description

If X is a linear container, i a valid index in a container of size #X + 1, and x a value that can be present in X, then insert(X, i, x) returns X with the value x inserted at index i (so that i is the index of x in insert(X, i, x)).

Examples

"Hello world"
Hello world
insert(ans, 6, ",")
Hello, world
insert(ans, −1, "!")
Hello, world!

See also