aggcat.spad line 531 [edit on github]
A set category lists a collection of set-theoretic operations useful for both finite sets and multisets. Note however that finite sets are distinct from multisets. Although the operations defined for set categories are common to both, the relationship between the two cannot be described by inclusion or inheritance.
difference(u, v)
returns the set aggregate w
consisting of elements in set aggregate u
but not in set aggregate v
. If u
and v
have no elements in common, difference(u, v)
returns a copy of u
. Note: equivalent to the notation (not currently supported) [x for x in u | not member?(x, v)]
.
difference(u, x)
returns the set aggregate u
with element x
removed. If u
does not contain x
, a copy of u
is returned. Note: difference(s, x) = difference(s, set [x])
.
intersect(u, v)
returns the set aggregate w
consisting of elements common to both set aggregates u
and v
. Note: equivalent to the notation (not currently supported) [x
for x
in u
| member?(x
, v
)].
set()
$D
creates an empty set aggregate of type D
.
set([x, y, ..., z])
creates a set aggregate containing items x
, y
, ..., z
.
subset?(u, v)
tests if u
is a subset of v
. Note: equivalent to reduce(and, [member?(x, v) for x in members(u)], true, false)
.
symmetricDifference(u, v)
returns the set aggregate of elements x
which are members of set aggregate u
or set aggregate v
but not both. If u
and v
have no elements in common, symmetricDifference(u, v)
returns a copy of u
. Note: symmetricDifference(u, v) = union(difference(u, v), difference(v, u))
union(u, v)
returns the set aggregate of elements which are members of either set aggregate u
or v
.
union(u, x)
returns the set aggregate u
with the element x
added. If u
already contains x
, union(u, x)
returns a copy of u
.
union(x, u)
returns the set aggregate u
with the element x
added. If u
already contains x
, union(x, u)
returns a copy of u
.
Collection(S)
Evalable(S)
InnerEvalable(S, S)