SetAggregate S¶
aggcat.spad line 531 [edit on github]
S: SetCategory
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 PartialOrder
- >: (%, %) -> Boolean
from PartialOrder
- any?: (S -> Boolean, %) -> 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
- count: (S -> Boolean, %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate S
- count: (S, %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate S
- difference: (%, %) -> %
difference(u, v)
returns the set aggregatew
consisting of elements in set aggregateu
but not in set aggregatev
. Ifu
andv
have no elements in common,difference(u, v)
returns a copy ofu
. 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 aggregateu
with elementx
removed. Ifu
does not containx
, a copy ofu
is returned. Note:difference(s, x) = difference(s, set [x])
.
- eval: (%, Equation S) -> % if S has Evalable S
from Evalable S
- eval: (%, List 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: (%, S, S) -> % if S has Evalable S
from InnerEvalable(S, S)
- every?: (S -> Boolean, %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate S
- find: (S -> Boolean, %) -> Union(S, failed)
from Collection S
- intersect: (%, %) -> %
intersect(u, v)
returns the set aggregatew
consisting of elements common to both set aggregatesu
andv
. Note: equivalent to the notation (not currently supported) [x
forx
inu
| member?(x
,v
)].
- latex: % -> String
from SetCategory
- less?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- map!: (S -> S, %) -> % if % has shallowlyMutable
from HomogeneousAggregate S
- map: (S -> S, %) -> %
from HomogeneousAggregate S
- max: % -> S if S has OrderedSet and % has finiteAggregate
from HomogeneousAggregate S
- max: ((S, S) -> Boolean, %) -> 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: ((S, S) -> S, %) -> S if % has finiteAggregate
from Collection S
- reduce: ((S, S) -> S, %, S) -> S if % has finiteAggregate
from Collection S
- reduce: ((S, S) -> S, %, S, S) -> S if % has finiteAggregate
from Collection S
- remove: (S -> Boolean, %) -> % if % has finiteAggregate
from Collection S
- remove: (S, %) -> % if % has finiteAggregate
from Collection S
- removeDuplicates: % -> % if % has finiteAggregate
from Collection S
- select: (S -> Boolean, %) -> % if % has finiteAggregate
from Collection S
- set: () -> %
set()
$D
creates an empty set aggregate of typeD
.
- set: List S -> %
set([x, y, ..., z])
creates a set aggregate containing itemsx
,y
, …,z
.
- size?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- subset?: (%, %) -> Boolean
subset?(u, v)
tests ifu
is a subset ofv
. Note: equivalent toreduce(and, [member?(x, v) for x in members(u)], true, false)
.
- symmetricDifference: (%, %) -> %
symmetricDifference(u, v)
returns the set aggregate of elementsx
which are members of set aggregateu
or set aggregatev
but not both. Ifu
andv
have no elements in common,symmetricDifference(u, v)
returns a copy ofu
. 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 aggregateu
orv
.
- union: (%, S) -> %
union(u, x)
returns the set aggregateu
with the elementx
added. Ifu
already containsx
,union(u, x)
returns a copy ofu
.
- union: (S, %) -> %
union(x, u)
returns the set aggregateu
with the elementx
added. Ifu
already containsx
,union(x, u)
returns a copy ofu
.
ConvertibleTo InputForm if S has ConvertibleTo InputForm
Evalable S if S has Evalable S
InnerEvalable(S, S) if S has Evalable S