LinearAggregate SΒΆ

aggcat.spad line 1647

A linear aggregate is an aggregate whose elements are indexed by integers. Examples of linear aggregates are strings, lists, and arrays. Most of the exported operations for linear aggregates are non-destructive but are not always efficient for a particular aggregate. For example, concat of two lists needs only to copy its first argument, whereas concat of two arrays needs to copy both arguments. Most of the operations exported here apply to infinite objects (e.g. streams) as well to finite ones. If the aggregate is a finite aggregate then it has several additional exports such as reverse, sort, and so on.

<: (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
<=: (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
=: (%, %) -> Boolean if S has BasicType and % has finiteAggregate or S has SetCategory
from BasicType
>: (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
>=: (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate
from PartialOrder
~=: (%, %) -> Boolean if S has BasicType and % has finiteAggregate or S has SetCategory
from BasicType
coerce: % -> OutputForm if S has CoercibleTo OutputForm
from CoercibleTo OutputForm
concat: (%, %) -> %
concat(u, v) returns an aggregate consisting of the elements of u followed by the elements of v. Note: if w = concat(u, v) then w.i = u.i for i in indices u and w.(j + maxIndex u) = v.j for j in indices v.
concat: (%, S) -> %
concat(u, x) returns aggregate u with additional element x at the end. Note: for lists, concat(u, x) == concat(u, [x])
concat: (S, %) -> %
concat(x, u) returns aggregate u with additional element at the front. Note: for lists: concat(x, u) == concat([x], u).
concat: List % -> %
concat(u), where u is a lists of aggregates [a, b, ..., c], returns a single aggregate consisting of the elements of a followed by those of b followed ... by the elements of c. Note: concat(a, b, ..., c) = concat(a, concat(b, ..., c)).
construct: List S -> %
from Collection S
convert: % -> InputForm if S has ConvertibleTo InputForm
from ConvertibleTo InputForm
copy: % -> %
from Aggregate
copyInto!: (%, %, Integer) -> % if % has shallowlyMutable and % has finiteAggregate
copyInto!(u, v, i) returns aggregate u containing a copy of v inserted at element i.
count: (S, %) -> NonNegativeInteger if S has BasicType and % has finiteAggregate
from HomogeneousAggregate S
delete: (%, Integer) -> %
delete(u, i) returns a copy of u with the ith element deleted. Note: for lists, delete(a, i) == concat(a(0..i - 1), a(i + 1, ..)).
delete: (%, UniversalSegment Integer) -> %
delete(u, i..j) returns a copy of u with the ith through jth element deleted. Note: delete(a, i..j) = concat(a(0..i-1), a(j+1..)).
elt: (%, Integer) -> S
from Eltable(Integer, S)
elt: (%, Integer, S) -> S
from EltableAggregate(Integer, S)
elt: (%, UniversalSegment Integer) -> %
from Eltable(UniversalSegment Integer, %)
empty: () -> %
from Aggregate
empty?: % -> Boolean
from Aggregate
entries: % -> List S
from IndexedAggregate(Integer, S)
entry?: (S, %) -> Boolean if S has BasicType and % has finiteAggregate
from IndexedAggregate(Integer, S)
eq?: (%, %) -> Boolean
from Aggregate
eval: (%, Equation S) -> % if S has Evalable S and S has SetCategory
from Evalable S
eval: (%, List Equation S) -> % if S has Evalable S and S has SetCategory
from Evalable S
eval: (%, List S, List S) -> % if S has Evalable S and S has SetCategory
from InnerEvalable(S, S)
eval: (%, S, S) -> % if S has Evalable S and S has SetCategory
from InnerEvalable(S, S)
find: (S -> Boolean, %) -> Union(S, failed)
from Collection S
first: % -> S
from IndexedAggregate(Integer, S)
hash: % -> SingleInteger if S has SetCategory
from SetCategory
hashUpdate!: (HashState, %) -> HashState if S has SetCategory
from SetCategory
index?: (Integer, %) -> Boolean
from IndexedAggregate(Integer, S)
indices: % -> List Integer
from IndexedAggregate(Integer, S)
insert: (%, %, Integer) -> %
insert(v, u, k) returns a copy of u having v inserted beginning at the ith element. Note: insert(v, u, k) = concat( u(0..k-1), v, u(k..) ).
insert: (S, %, Integer) -> %
insert(x, u, i) returns a copy of u having x as its ith element. Note: insert(x, a, k) = concat(concat(a(0..k-1), x), a(k..)).
latex: % -> String if S has SetCategory
from SetCategory
leftTrim: (%, S) -> % if S has BasicType and % has finiteAggregate
leftTrim(u, x) returns a copy of u with all leading x deleted. For example, leftTrim(" abc ", char " ") returns "abc ".
less?: (%, NonNegativeInteger) -> Boolean
from Aggregate
map: ((S, S) -> S, %, %) -> %
map(f, u, v) returns a new collection w with elements z = f(x, y) for corresponding elements x and y from u and v. Note: for linear aggregates, w.i = f(u.i, v.i).
map: (S -> S, %) -> %
from HomogeneousAggregate S
max: (%, %) -> % if S has OrderedSet and % has finiteAggregate
from OrderedSet
maxIndex: % -> Integer
from IndexedAggregate(Integer, S)
member?: (S, %) -> Boolean if S has BasicType and % has finiteAggregate
from HomogeneousAggregate S
merge: (%, %) -> % if S has OrderedSet and % has finiteAggregate
merge(u, v) merges u and v in ascending order. Note: merge(u, v) = merge(<=, u, v).
min: (%, %) -> % if S has OrderedSet and % has finiteAggregate
from OrderedSet
minIndex: % -> Integer
from IndexedAggregate(Integer, S)
more?: (%, NonNegativeInteger) -> Boolean
from Aggregate
new: (NonNegativeInteger, S) -> %
new(n, x) returns a new aggregate of size n all of whose entries are x.
position: (S, %) -> Integer if S has BasicType and % has finiteAggregate
position(x, a) returns the index i of the first occurrence of x in a, and minIndex(a) - 1 if there is no such x.
position: (S, %, Integer) -> Integer if S has BasicType and % has finiteAggregate
position(x, a, n) returns the index i of the first occurrence of x in a where i >= n, and minIndex(a) - 1 if no such x is found.
qelt: (%, Integer) -> S
from EltableAggregate(Integer, S)
reduce: ((S, S) -> S, %, S, S) -> S if S has BasicType and % has finiteAggregate
from Collection S
remove: (S, %) -> % if S has BasicType and % has finiteAggregate
from Collection S
removeDuplicates: % -> % if S has BasicType and % has finiteAggregate
from Collection S
reverse!: % -> % if % has shallowlyMutable and % has finiteAggregate
reverse!(u) returns u with its elements in reverse order.
rightTrim: (%, S) -> % if S has BasicType and % has finiteAggregate
rightTrim(u, x) returns a copy of u with all trailing occurrences of x deleted. For example, rightTrim(" abc ", char " ") returns "abc ".
sample: %
from Aggregate
size?: (%, NonNegativeInteger) -> Boolean
from Aggregate
smaller?: (%, %) -> Boolean if S has OrderedSet and % has finiteAggregate or S has Comparable and % has finiteAggregate
from Comparable
sort!: % -> % if S has OrderedSet and % has shallowlyMutable and % has finiteAggregate
sort!(u) returns u with its elements in ascending order.
sort!: ((S, S) -> Boolean, %) -> % if % has shallowlyMutable and % has finiteAggregate
sort!(p, u) returns u with its elements ordered by p.
sort: % -> % if S has OrderedSet and % has finiteAggregate
sort(u) returns an u with elements in ascending order. Note: sort(u) = sort(<=, u).
sorted?: % -> Boolean if S has OrderedSet and % has finiteAggregate
sorted?(u) tests if the elements of u are in ascending order.
trim: (%, S) -> % if S has BasicType and % has finiteAggregate
trim(u, x) returns a copy of u with all occurrences of x deleted from right and left ends. For example, trim(" abc ", char " ") returns "abc".

Aggregate

BasicType if S has BasicType and % has finiteAggregate or S has SetCategory

CoercibleTo OutputForm if S has CoercibleTo OutputForm

Collection S

Comparable if S has OrderedSet and % has finiteAggregate or S has Comparable and % has finiteAggregate

ConvertibleTo InputForm if S has ConvertibleTo InputForm

Eltable(Integer, S)

Eltable(UniversalSegment Integer, %)

EltableAggregate(Integer, S)

Evalable S if S has Evalable S and S has SetCategory

HomogeneousAggregate S

IndexedAggregate(Integer, S)

InnerEvalable(S, S) if S has Evalable S and S has SetCategory

OrderedSet if S has OrderedSet and % has finiteAggregate

PartialOrder if S has OrderedSet and % has finiteAggregate

SetCategory if S has SetCategory