# AggregateΒΆ

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.

- #: % -> NonNegativeInteger if % has finiteAggregate
`\# u`

returns the number of items in`u`

.

- copy: % -> %
`copy(u)`

returns a top-level (non-recursive) copy of`u`

. Note: for collections,`copy(u) == [x for x in u]`

.

- empty: () -> %
`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?: % -> Boolean
`empty?(u)`

tests if`u`

has 0 elements.

- eq?: (%, %) -> Boolean
`eq?(u, v)`

tests if`u`

and`v`

are same objects.

- less?: (%, NonNegativeInteger) -> Boolean
`less?(u, n)`

tests if`u`

has less than`n`

elements.

- more?: (%, NonNegativeInteger) -> Boolean
`more?(u, n)`

tests if`u`

has greater than`n`

elements.

- sample: %
`sample yields`

a value of type %

- size?: (%, NonNegativeInteger) -> Boolean
`size?(u, n)`

tests if`u`

has exactly`n`

elements.