FlexibleArray(S)

array1.spad line 328 [edit on github]

A FlexibleArray is the notion of an array intended to allow for growth at the end only. Hence the following efficient operations concat!(a, x) meaning append item x at the end of the array a delete!(a, n) meaning delete the last item from the array a Flexible arrays support the other operations inherited from ExtensibleLinearAggregate. However, these are not efficient. Flexible arrays combine the O(1) access time property of arrays with growing and shrinking at the end in O(1) (average) time. This is done by using an ordinary array which may have zero or more empty slots at the end. When the array becomes full it is copied into a new larger (50% larger) array. Conversely, when the array becomes less than 1/2 full, it is copied into a smaller array. Flexible arrays provide for an efficient implementation of many data structures in particular heaps, stacks and sets.

# : % -> NonNegativeInteger
from Aggregate
< : (%, %) -> Boolean if S has OrderedSet
from PartialOrder
<= : (%, %) -> Boolean if S has OrderedSet
from PartialOrder
= : (%, %) -> Boolean if S has BasicType
from BasicType
> : (%, %) -> Boolean if S has OrderedSet
from PartialOrder
>= : (%, %) -> Boolean if S has OrderedSet
from PartialOrder
any? : (Mapping(Boolean, S), %) -> Boolean
from HomogeneousAggregate(S)
coerce : % -> OutputForm if S has CoercibleTo(OutputForm)
from CoercibleTo(OutputForm)
concat : (%, %) -> %
from LinearAggregate(S)
concat : (%, S) -> %
from LinearAggregate(S)
concat : (S, %) -> %
from LinearAggregate(S)
concat : List(%) -> %
from LinearAggregate(S)
concat! : (%, %) -> %
from ExtensibleLinearAggregate(S)
concat! : (%, S) -> %
from ExtensibleLinearAggregate(S)
construct : List(S) -> %
from Collection(S)
convert : % -> InputForm if S has ConvertibleTo(InputForm)
from ConvertibleTo(InputForm)
copy : % -> %
from Aggregate
copyInto! : (%, %, Integer) -> %
from LinearAggregate(S)
count : (S, %) -> NonNegativeInteger if S has BasicType
from HomogeneousAggregate(S)
count : (Mapping(Boolean, S), %) -> NonNegativeInteger
from HomogeneousAggregate(S)
delete : (%, Integer) -> %
from LinearAggregate(S)
delete : (%, UniversalSegment(Integer)) -> %
from LinearAggregate(S)
delete! : (%, Integer) -> %
from ExtensibleLinearAggregate(S)
delete! : (%, UniversalSegment(Integer)) -> %
from ExtensibleLinearAggregate(S)
elt : (%, UniversalSegment(Integer)) -> %
from Eltable(UniversalSegment(Integer), %)
elt : (%, Integer) -> S
from Eltable(Integer, S)
elt : (%, Integer, S) -> S
from EltableAggregate(Integer, S)
empty : () -> %
from Aggregate
empty? : % -> Boolean
from Aggregate
entries : % -> List(S)
from IndexedAggregate(Integer, S)
entry? : (S, %) -> Boolean if S has BasicType
from IndexedAggregate(Integer, S)
eq? : (%, %) -> Boolean
from Aggregate
eval : (%, S, S) -> % if S has Evalable(S) and S has SetCategory
from InnerEvalable(S, S)
eval : (%, 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 : (%, List(Equation(S))) -> % if S has Evalable(S) and S has SetCategory
from Evalable(S)
every? : (Mapping(Boolean, S), %) -> Boolean
from HomogeneousAggregate(S)
fill! : (%, S) -> %
from IndexedAggregate(Integer, S)
find : (Mapping(Boolean, S), %) -> Union(S, "failed")
from Collection(S)
first : (%, NonNegativeInteger) -> %
from LinearAggregate(S)
first : % -> S
from IndexedAggregate(Integer, S)
flexibleArray : List(S) -> %

hash : % -> SingleInteger if S has Hashable
from Hashable
hashUpdate! : (HashState, %) -> HashState if S has Hashable
from Hashable
index? : (Integer, %) -> Boolean
from IndexedAggregate(Integer, S)
indices : % -> List(Integer)
from IndexedAggregate(Integer, S)
insert : (%, %, Integer) -> %
from LinearAggregate(S)
insert : (S, %, Integer) -> %
from LinearAggregate(S)
insert! : (%, %, Integer) -> %
from ExtensibleLinearAggregate(S)
insert! : (S, %, Integer) -> %
from ExtensibleLinearAggregate(S)
latex : % -> String if S has SetCategory
from SetCategory
leftTrim : (%, S) -> % if S has BasicType
from LinearAggregate(S)
less? : (%, NonNegativeInteger) -> Boolean
from Aggregate
map : (Mapping(S, S), %) -> %
from HomogeneousAggregate(S)
map : (Mapping(S, S, S), %, %) -> %
from LinearAggregate(S)
map! : (Mapping(S, S), %) -> %
from HomogeneousAggregate(S)
max : (%, %) -> % if S has OrderedSet
from OrderedSet
max : % -> S if S has OrderedSet
from HomogeneousAggregate(S)
max : (Mapping(Boolean, S, S), %) -> S
from HomogeneousAggregate(S)
maxIndex : % -> Integer
from IndexedAggregate(Integer, S)
member? : (S, %) -> Boolean if S has BasicType
from HomogeneousAggregate(S)
members : % -> List(S)
from HomogeneousAggregate(S)
merge : (%, %) -> % if S has OrderedSet
from LinearAggregate(S)
merge : (Mapping(Boolean, S, S), %, %) -> %
from LinearAggregate(S)
merge! : (%, %) -> % if S has OrderedSet
from ExtensibleLinearAggregate(S)
merge! : (Mapping(Boolean, S, S), %, %) -> %
from ExtensibleLinearAggregate(S)
min : (%, %) -> % if S has OrderedSet
from OrderedSet
min : % -> S if S has OrderedSet
from HomogeneousAggregate(S)
minIndex : % -> Integer
from IndexedAggregate(Integer, S)
more? : (%, NonNegativeInteger) -> Boolean
from Aggregate
new : (NonNegativeInteger, S) -> %
from LinearAggregate(S)
parts : % -> List(S)
from HomogeneousAggregate(S)
physicalLength : % -> NonNegativeInteger

physicalLength! : (%, Integer) -> %

position : (S, %) -> Integer if S has BasicType
from LinearAggregate(S)
position : (S, %, Integer) -> Integer if S has BasicType
from LinearAggregate(S)
position : (Mapping(Boolean, S), %) -> Integer
from LinearAggregate(S)
qelt : (%, Integer) -> S
from EltableAggregate(Integer, S)
qsetelt! : (%, Integer, S) -> S
from EltableAggregate(Integer, S)
reduce : (Mapping(S, S, S), %) -> S
from Collection(S)
reduce : (Mapping(S, S, S), %, S) -> S
from Collection(S)
reduce : (Mapping(S, S, S), %, S, S) -> S if S has BasicType
from Collection(S)
remove : (S, %) -> % if S has BasicType
from Collection(S)
remove : (Mapping(Boolean, S), %) -> %
from Collection(S)
remove! : (S, %) -> % if S has BasicType
from ExtensibleLinearAggregate(S)
remove! : (Mapping(Boolean, S), %) -> %
from ExtensibleLinearAggregate(S)
removeDuplicates : % -> % if S has BasicType
from Collection(S)
removeDuplicates! : % -> % if S has BasicType
from ExtensibleLinearAggregate(S)
removeRepeats! : % -> %

reverse : % -> %
from LinearAggregate(S)
reverse! : % -> %
from LinearAggregate(S)
rightTrim : (%, S) -> % if S has BasicType
from LinearAggregate(S)
sample : () -> %
from Aggregate
select : (Mapping(Boolean, S), %) -> %
from Collection(S)
select! : (Mapping(Boolean, S), %) -> %
from ExtensibleLinearAggregate(S)
setelt! : (%, Integer, S) -> S
from EltableAggregate(Integer, S)
setelt! : (%, UniversalSegment(Integer), S) -> S
from LinearAggregate(S)
shrinkable : Boolean -> Boolean

size? : (%, NonNegativeInteger) -> Boolean
from Aggregate
smaller? : (%, %) -> Boolean if S has Comparable
from Comparable
sort : % -> % if S has OrderedSet
from LinearAggregate(S)
sort : (Mapping(Boolean, S, S), %) -> %
from LinearAggregate(S)
sort! : % -> % if S has OrderedSet
from LinearAggregate(S)
sort! : (Mapping(Boolean, S, S), %) -> %
from LinearAggregate(S)
sorted? : % -> Boolean if S has OrderedSet
from LinearAggregate(S)
sorted? : (Mapping(Boolean, S, S), %) -> Boolean
from LinearAggregate(S)
swap! : (%, Integer, Integer) -> Void
from IndexedAggregate(Integer, S)
trim : (%, S) -> % if S has BasicType
from LinearAggregate(S)
~= : (%, %) -> Boolean if S has BasicType
from BasicType

Comparable

ConvertibleTo(InputForm)

shallowlyMutable

InnerEvalable(S, S)

Aggregate

Eltable(Integer, S)

LinearAggregate(S)

IndexedAggregate(Integer, S)

OrderedSet

FiniteLinearAggregate(S)

OneDimensionalArrayAggregate(S)

SetCategory

Evalable(S)

HomogeneousAggregate(S)

PartialOrder

ExtensibleLinearAggregate(S)

CoercibleTo(OutputForm)

Collection(S)

Eltable(UniversalSegment(Integer), %)

EltableAggregate(Integer, S)

finiteAggregate

Hashable

BasicType