# HomogeneousAggregate SΒΆ

- S: Type

A homogeneous aggregate is an aggregate of elements all of the same type. In the current system, all aggregates are homogeneous. Two attributes characterize classes of aggregates. Aggregates from domains with attribute finiteAggregate have a finite number of members. Of course, such a domain may have an infinite number of elements, like, for example List. Those domains with attribute shallowlyMutable allow an element to be modified or updated without changing its overall value.

- =: (%, %) -> Boolean if S has SetCategory or S has BasicType and % has finiteAggregate
- from BasicType
- ~=: (%, %) -> Boolean if S has SetCategory or S has BasicType and % has finiteAggregate
- from BasicType
- coerce: % -> OutputForm if S has CoercibleTo OutputForm
- from CoercibleTo OutputForm
- copy: % -> %
- from Aggregate

- count: (S, %) -> NonNegativeInteger if S has BasicType and % has finiteAggregate
`count(x, u)`

returns the number of occurrences of`x`

in`u`

. For collections,`count(x, u) = reduce(+, [1 for y in u | x = y], 0)`

.- empty: () -> %
- from Aggregate
- empty?: % -> Boolean
- from Aggregate
- 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)
- hash: % -> SingleInteger if S has SetCategory
- from SetCategory
- hashUpdate!: (HashState, %) -> HashState if S has SetCategory
- from SetCategory
- latex: % -> String if S has SetCategory
- from SetCategory
- less?: (%, NonNegativeInteger) -> Boolean
- from Aggregate

- map: (S -> S, %) -> %
`map(f, u)`

returns a copy of`u`

with each element`x`

replaced by`f`

(`x`

). For collections,`map(f, u) = [f(x) for x in u]`

.

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

tests if`x`

is a member of`u`

. For collections,`member?(x, u) = reduce(or, [x=y for y in u], false)`

. However,`member?(x, u)`

returns as soon as it finds a member.- more?: (%, NonNegativeInteger) -> Boolean
- from Aggregate
- sample: %
- from Aggregate
- size?: (%, NonNegativeInteger) -> Boolean
- from Aggregate

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

CoercibleTo OutputForm if S has CoercibleTo OutputForm

Evalable S if S has Evalable S and S has SetCategory

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

SetCategory if S has SetCategory