Algosim documentation: append

append

Appends an element to the end of a linear container.

Syntax

Description

If X is any linear container and x any object that can be present in X, then append(X, x) returns X with x added at the end, so that #append(X, x) = #X + 1 and last(append(X, x)) = x.

The difference between append and ExtendWith becomes evident if x is a container itself. In this case, the difference is that append(X, x) adds the object x to the end of X, while ExtendWith(X, x) attempts to add the contents of x to the end of X, possibly adding several (specifically, #x) new elements to X.

Examples

v ≔ SequenceVector(10)
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
append(v, 11)
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
L ≔ '(1, 2, 3)
1
2
3
append(L, '(4, 5))
1
2
3
(4, 5)

See also