Creation of New Lists#

Here, \(S\) denotes the list \({[*}\ s_1, \ldots, s_n\ {*]}\), while \(T\) denotes the list \({[*}\ t_1, \ldots, t_m\ {*]}\).

S cat T: List, List -> List#

The list formed by concatenating the terms of the list \(S\) with the terms of the list \(T\), i.e. the list \({[*}\ s_1, \ldots, s_n, t_1,\ldots, t_m\ {*]}\).

S cat:= T: List, List#

(Procedure.) Destructively concatenate the terms of the list \(T\) to \(S\); i.e. so \(S\) becomes the list \({[*}\ s_1, \ldots, s_n, t_1,\ldots, t_m\ {*]}\).

Append(S, x): List, Elt -> List#

The list formed by adding the object \(x\) to the end of the list \(S\), i.e. the list \({[*}\ s_1,\ldots s_n, x\ {*]}\).

Append(~S, x): List, Elt#

(Procedure.) Destructively add the object \(x\) to the end of the list \(S\); i.e. so \(S\) becomes the list \({[*}\ s_1,\ldots s_n, x\ {*]}\).

Insert(~S, i, x): List, RngIntElt, Any#
Insert(S, i, x): List, RngIntElt, Any -> List#

Create the list formed by inserting the object \(x\) at position \(i\) in \(S\) and moving the terms \(S[i], \ldots, S[n]\) down one place, i.e., the list \({[*}\ s_1, \ldots, s_{i-1}, x, s_{i}, \ldots, s_{n}\ {*]}\). Note that \(i\) must not be bigger than \(n+1\) where \(n\) is the length of \(S\). There are two versions of this: a procedure, where \(S\) is replaced by the new list, and a function, which returns the new list. The procedural version takes a reference \(\sim S\) to \(S\) as an argument. Note that the procedural version is much more efficient since the list \(S\) will not be copied.

Prune(S): List -> List#

The list formed by removing the last term of the list \(S\), i.e. the list \({[*}\ s_1\), \(\ldots\), \(s_{n-1}\ {*]}\).

Prune(~S): List#

(Procedure.) Destructively remove the last term of the list \(S\); i.e. so \(S\) becomes the list \({[*}\ s_1\), \(\ldots\), \(s_{n-1}\ {*]}\).

SequenceToList(Q): SeqEnum -> List#
Seqlist(Q): SeqEnum -> List#

Given a sequence \(Q\), construct a list whose terms are the elements of \(Q\) taken in the same order.

TupleToList(T): Tup -> List#
Tuplist(T): Tup -> List#

Given a tuple \(T\), construct a list whose terms are the elements of \(T\) taken in the same order.

Reverse(L): List -> List#

Given a list \(L\) return the same list, but in reverse order.