aggcat.spad line 1 [edit on github]
The notion of aggregate serves to model any data structure aggregate, designating any collection of objects, with heterogeneous or homogeneous members, with a finite or infinite number of members, explicitly or implicitly represented. An aggregate can in principle represent everything from a string of characters to abstract sets such as "the set of x
satisfying relation r(x)". An attribute finiteAggregate is used to assert that a domain has a finite number of elements.
#(u)
returns the number of elements in u
.
copy(u)
returns a top-level (non-recursive) copy of u
. Note: for collections, copy(u) = [x for x in u]
.
empty()
$D
creates an aggregate of type D
with 0 elements. Note: The $D can be dropped if understood by context, e.g. u: D := empty()
.
empty?(u)
tests if u
has 0 elements.
eq?(u, v)
tests if u
and v
are same objects.
less?(u, n)
tests if u
has less than n
elements.
more?(u, n)
tests if u
has more than n
elements.
sample yields
a value of type %
size?(u, n)
tests if u
has exactly n
elements.