SetAggregate(S)

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.

# : % -> NonNegativeInteger if % has finiteAggregate
from Aggregate
< : (%, %) -> Boolean
from PartialOrder
<= : (%, %) -> Boolean
from PartialOrder
= : (%, %) -> Boolean
from BasicType
> : (%, %) -> Boolean
from PartialOrder
>= : (%, %) -> Boolean
from PartialOrder
any? : (Mapping(Boolean, S), %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate(S)
coerce : % -> OutputForm
from CoercibleTo(OutputForm)
construct : List(S) -> %
from Collection(S)
convert : % -> InputForm if S has ConvertibleTo(InputForm)
from ConvertibleTo(InputForm)
copy : % -> %
from Aggregate
count : (S, %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate(S)
count : (Mapping(Boolean, S), %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate(S)
difference : (%, %) -> %

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 : (%, S) -> %

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

empty : () -> %
from Aggregate
empty? : % -> Boolean
from Aggregate
eq? : (%, %) -> Boolean
from Aggregate
eval : (%, S, S) -> % if S has Evalable(S)
from InnerEvalable(S, S)
eval : (%, Equation(S)) -> % if S has Evalable(S)
from Evalable(S)
eval : (%, List(S), List(S)) -> % if S has Evalable(S)
from InnerEvalable(S, S)
eval : (%, List(Equation(S))) -> % if S has Evalable(S)
from Evalable(S)
every? : (Mapping(Boolean, S), %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate(S)
find : (Mapping(Boolean, S), %) -> Union(S, "failed")
from Collection(S)
intersect : (%, %) -> %

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

latex : % -> String
from SetCategory
less? : (%, NonNegativeInteger) -> Boolean
from Aggregate
map : (Mapping(S, S), %) -> %
from HomogeneousAggregate(S)
map! : (Mapping(S, S), %) -> % if % has shallowlyMutable
from HomogeneousAggregate(S)
max : % -> S if S has OrderedSet and % has finiteAggregate
from HomogeneousAggregate(S)
max : (Mapping(Boolean, S, S), %) -> S if % has finiteAggregate
from HomogeneousAggregate(S)
member? : (S, %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate(S)
members : % -> List(S) if % has finiteAggregate
from HomogeneousAggregate(S)
min : % -> S if S has OrderedSet and % has finiteAggregate
from HomogeneousAggregate(S)
more? : (%, NonNegativeInteger) -> Boolean
from Aggregate
parts : % -> List(S) if % has finiteAggregate
from HomogeneousAggregate(S)
reduce : (Mapping(S, S, S), %) -> S if % has finiteAggregate
from Collection(S)
reduce : (Mapping(S, S, S), %, S) -> S if % has finiteAggregate
from Collection(S)
reduce : (Mapping(S, S, S), %, S, S) -> S if % has finiteAggregate
from Collection(S)
remove : (S, %) -> % if % has finiteAggregate
from Collection(S)
remove : (Mapping(Boolean, S), %) -> % if % has finiteAggregate
from Collection(S)
removeDuplicates : % -> % if % has finiteAggregate
from Collection(S)
sample : () -> %
from Aggregate
select : (Mapping(Boolean, S), %) -> % if % has finiteAggregate
from Collection(S)
set : () -> %

set()$D creates an empty set aggregate of type D.

set : List(S) -> %

set([x, y, ..., z]) creates a set aggregate containing items x, y, ..., z.

size? : (%, NonNegativeInteger) -> Boolean
from Aggregate
subset? : (%, %) -> Boolean

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 : (%, %) -> %

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 : (%, %) -> %

union(u, v) returns the set aggregate of elements which are members of either set aggregate u or v.

union : (%, S) -> %

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 : (S, %) -> %

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.

~= : (%, %) -> Boolean
from BasicType

CoercibleTo(OutputForm)

HomogeneousAggregate(S)

Collection(S)

SetCategory

Evalable(S)

ConvertibleTo(InputForm)

PartialOrder

BasicType

Aggregate

InnerEvalable(S, S)