HomogeneousAggregate SΒΆ

aggcat.spad line 56 [edit on github]

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.

#: % -> NonNegativeInteger if % has finiteAggregate

from Aggregate

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

from BasicType

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

from BasicType

any?: (S -> Boolean, %) -> Boolean if % has finiteAggregate

any?(p, u) tests if p(x) is true for any element x of u. Note: for collections, any?(p, u) = reduce(or, map(p, u), false, true). However, any?(p, u) returns as soon as it finds an element for which p gives true.

coerce: % -> OutputForm if S has CoercibleTo OutputForm

from CoercibleTo OutputForm

copy: % -> %

from Aggregate

count: (S -> Boolean, %) -> NonNegativeInteger if % has finiteAggregate

count(p, u) returns the number of elements x in u such that p(x) is true. For collections, count(p, u) = reduce(+, [1 for x in u | p(x)], 0).

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?: % -> Boolean

from Aggregate

empty: () -> %

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)

every?: (S -> Boolean, %) -> Boolean if % has finiteAggregate

every?(p, u) tests if p(x) is true for all elements x of u. Note: for collections, every?(p, u) = reduce(and, map(p, u), true, false). However, every?(p, u) returns as soon as it finds an element for which p gives false.

latex: % -> String if S has SetCategory

from SetCategory

less?: (%, NonNegativeInteger) -> Boolean

from Aggregate

map!: (S -> S, %) -> % if % has shallowlyMutable

map!(f, u) destructively replaces each element x of u by f(x).

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].

max: % -> S if S has OrderedSet and % has finiteAggregate

max(u) returns maximal element of u. Error if u is empty.

max: ((S, S) -> Boolean, %) -> S if % has finiteAggregate

max(p, u) returns maximal element of u with respect to total ordering predicate p. Error if u is empty.

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.

members: % -> List S if % has finiteAggregate

members(u) returns a list of the consecutive elements of u. For multisets members gives result with no repetition. See also parts.

min: % -> S if S has OrderedSet and % has finiteAggregate

min(u) returns minimal element of u. Error if u is empty.

more?: (%, NonNegativeInteger) -> Boolean

from Aggregate

parts: % -> List S if % has finiteAggregate

parts(u) returns a list of the consecutive elements of u. For finite collections, construct(parts(u)) = u.

sample: %

from Aggregate

size?: (%, NonNegativeInteger) -> Boolean

from Aggregate

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