# IndexedAggregate(Index, Entry)ΒΆ

aggcat.spad line 824 [edit on github]

An indexed aggregate is a many-to-one mapping of indices to entries. For example, a one-dimensional-array is an indexed aggregate where the index is an integer. Also, a table is an indexed aggregate where the indices and entries may have any type.

- #: % -> NonNegativeInteger if % has finiteAggregate
from Aggregate

- =: (%, %) -> Boolean if Entry has BasicType and % has finiteAggregate or Entry has SetCategory
from BasicType

- ~=: (%, %) -> Boolean if Entry has BasicType and % has finiteAggregate or Entry has SetCategory
from BasicType

- any?: (Entry -> Boolean, %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate Entry

- coerce: % -> OutputForm if Entry has CoercibleTo OutputForm
from CoercibleTo OutputForm

- count: (Entry -> Boolean, %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate Entry

- count: (Entry, %) -> NonNegativeInteger if Entry has BasicType and % has finiteAggregate
from HomogeneousAggregate Entry

- elt: (%, Index) -> Entry
from Eltable(Index, Entry)

- elt: (%, Index, Entry) -> Entry
from EltableAggregate(Index, Entry)

- entries: % -> List Entry
`entries(u)`

returns a list of all the entries of aggregate`u`

in no assumed order.

- entry?: (Entry, %) -> Boolean if Entry has BasicType and % has finiteAggregate
`entry?(x, u)`

tests if`x`

equals`u . i`

for some index`i`

.

- eval: (%, Entry, Entry) -> % if Entry has SetCategory and Entry has Evalable Entry
from InnerEvalable(Entry, Entry)

- eval: (%, Equation Entry) -> % if Entry has SetCategory and Entry has Evalable Entry
from Evalable Entry

- eval: (%, List Entry, List Entry) -> % if Entry has SetCategory and Entry has Evalable Entry
from InnerEvalable(Entry, Entry)

- eval: (%, List Equation Entry) -> % if Entry has SetCategory and Entry has Evalable Entry
from Evalable Entry

- every?: (Entry -> Boolean, %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate Entry

- fill!: (%, Entry) -> % if % has shallowlyMutable
`fill!(u, x)`

replaces each entry in aggregate`u`

by`x`

. The modified`u`

is returned as value.

- first: % -> Entry if Index has OrderedSet
`first(u)`

returns the first element`x`

of`u`

. Note: for collections,`first([x, y, ..., z]) = x`

. Error: if`u`

is empty.

- hash: % -> SingleInteger if Entry has SetCategory
from SetCategory

- hashUpdate!: (HashState, %) -> HashState if Entry has SetCategory
from SetCategory

- index?: (Index, %) -> Boolean
`index?(i, u)`

tests if`i`

is an index of aggregate`u`

.

- indices: % -> List Index
`indices(u)`

returns a list of indices of aggregate`u`

in no particular order.

- latex: % -> String if Entry has SetCategory
from SetCategory

- less?: (%, NonNegativeInteger) -> Boolean
from Aggregate

- map!: (Entry -> Entry, %) -> % if % has shallowlyMutable
from HomogeneousAggregate Entry

- map: (Entry -> Entry, %) -> %
from HomogeneousAggregate Entry

- max: % -> Entry if Entry has OrderedSet and % has finiteAggregate
from HomogeneousAggregate Entry

- max: ((Entry, Entry) -> Boolean, %) -> Entry if % has finiteAggregate
from HomogeneousAggregate Entry

- maxIndex: % -> Index if Index has OrderedSet
`maxIndex(u)`

returns the maximum index`i`

of aggregate`u`

. Note: in general,`maxIndex(u) = reduce(max, indices u)`

; for List,`maxIndex(u) = \#u`

.

- member?: (Entry, %) -> Boolean if Entry has BasicType and % has finiteAggregate
from HomogeneousAggregate Entry

- members: % -> List Entry if % has finiteAggregate
from HomogeneousAggregate Entry

- min: % -> Entry if Entry has OrderedSet and % has finiteAggregate
from HomogeneousAggregate Entry

- minIndex: % -> Index if Index has OrderedSet
`minIndex(u)`

returns the minimum index`i`

of aggregate`u`

. Note: in general,`minIndex(a) = reduce(min, indices a)`

; for List,`minIndex(a) = 1`

.

- more?: (%, NonNegativeInteger) -> Boolean
from Aggregate

- parts: % -> List Entry if % has finiteAggregate
from HomogeneousAggregate Entry

- qelt: (%, Index) -> Entry
from EltableAggregate(Index, Entry)

- qsetelt!: (%, Index, Entry) -> Entry if % has shallowlyMutable
from EltableAggregate(Index, Entry)

- setelt!: (%, Index, Entry) -> Entry if % has shallowlyMutable
from EltableAggregate(Index, Entry)

- size?: (%, NonNegativeInteger) -> Boolean
from Aggregate

- swap!: (%, Index, Index) -> Void if % has shallowlyMutable
`swap!(u, i, j)`

interchanges elements`i`

and`j`

of aggregate`u`

. No meaningful value is returned.

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

CoercibleTo OutputForm if Entry has CoercibleTo OutputForm

Eltable(Index, Entry)

EltableAggregate(Index, Entry)

Evalable Entry if Entry has SetCategory and Entry has Evalable Entry

HomogeneousAggregate Entry

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

SetCategory if Entry has SetCategory