# IndexedAggregate(Index, Entry)ΒΆ

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.

- =: (%, %) -> Boolean if % has finiteAggregate and Entry has BasicType or Entry has SetCategory
- from BasicType
- ~=: (%, %) -> Boolean if % has finiteAggregate and Entry has BasicType or Entry has SetCategory
- from BasicType
- coerce: % -> OutputForm if Entry has CoercibleTo OutputForm
- from CoercibleTo OutputForm
- copy: % -> %
- from Aggregate
- count: (Entry, %) -> NonNegativeInteger if % has finiteAggregate and Entry has BasicType
- from HomogeneousAggregate Entry
- elt: (%, Index) -> Entry
- from Eltable(Index, Entry)
- elt: (%, Index, Entry) -> Entry
- from EltableAggregate(Index, Entry)
- empty: () -> %
- from Aggregate
- empty?: % -> Boolean
- from Aggregate

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

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

in no assumed order.

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

tests if`x`

equals`u . i`

for some index`i`

.- eq?: (%, %) -> Boolean
- from Aggregate
- 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

- 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, %) -> %
- 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, [i for i in indices u])`

; if`u`

is a list,`maxIndex(u) = \#u`

.- member?: (Entry, %) -> Boolean if % has finiteAggregate and Entry has BasicType
- 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, [i for i in indices a])`

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

.- more?: (%, NonNegativeInteger) -> Boolean
- from Aggregate
- qelt: (%, Index) -> Entry
- from EltableAggregate(Index, Entry)
- sample: %
- from Aggregate
- size?: (%, NonNegativeInteger) -> Boolean
- from Aggregate

BasicType if % has finiteAggregate and Entry has BasicType 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