RecursiveAggregate(S)

aggcat.spad line 1046 [edit on github]

A recursive aggregate over a type S is a model for a a directed graph containing values of type S. Recursively, a recursive aggregate is either empty or a node consisting of a value from S and 0 or more children which are also nodes. A node with no children is called a leaf node. A recursive aggregate may be cyclic for which some operations as noted may go into an infinite loop.

# : % -> NonNegativeInteger if % has finiteAggregate
from Aggregate
= : (%, %) -> Boolean if S has SetCategory or S has BasicType and % has finiteAggregate
from BasicType
any? : (Mapping(Boolean, S), %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate(S)
child? : (%, %) -> Boolean if S has BasicType

child?(u, v) tests if node u is a child of node v.

children : % -> List(%)

children(u) returns a list of the children of aggregate u. Error: if u is empty.

coerce : % -> OutputForm if S has CoercibleTo(OutputForm)
from CoercibleTo(OutputForm)
copy : % -> %
from Aggregate
count : (S, %) -> NonNegativeInteger if S has BasicType and % has finiteAggregate
from HomogeneousAggregate(S)
count : (Mapping(Boolean, S), %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate(S)
cyclic? : % -> Boolean

cyclic?(u) tests if u has a cycle.

distance : (%, %) -> Integer

distance(u, v) returns the path length (an integer) from node u to v.

elt : (%, "value") -> S

elt(u, "value") (also written: u.value) is equivalent to value(u).

empty : () -> %
from Aggregate
empty? : % -> Boolean
from Aggregate
eq? : (%, %) -> Boolean
from Aggregate
eval : (%, S, S) -> % if S has Evalable(S) and S has SetCategory
from InnerEvalable(S, S)
eval : (%, Equation(S)) -> % if S has Evalable(S) and S has SetCategory
from Evalable(S)
eval : (%, List(S), List(S)) -> % if S has Evalable(S) and S has SetCategory
from InnerEvalable(S, S)
eval : (%, List(Equation(S))) -> % if S has Evalable(S) and S has SetCategory
from Evalable(S)
every? : (Mapping(Boolean, S), %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate(S)
latex : % -> String if S has SetCategory
from SetCategory
leaf? : % -> Boolean

leaf?(u) tests if u is a terminal node.

leaves : % -> List(S)

leaves(u) returns the list of leaves in aggregate u.

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 S has BasicType and % 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
node? : (%, %) -> Boolean if S has BasicType

node?(u, v) tests if node u is contained in node v (either as a child, a child of a child, etc.).

nodes : % -> List(%)

nodes(u) returns a list of all of the nodes of aggregate u.

parts : % -> List(S) if % has finiteAggregate
from HomogeneousAggregate(S)
sample : () -> %
from Aggregate
setchildren! : (%, List(%)) -> % if % has shallowlyMutable

setchildren!(u, v) replaces the current children of node u with the members of v in left-to-right order.

setelt! : (%, "value", S) -> S if % has shallowlyMutable

setelt!(u, "value", x) (also written u.value := x) is equivalent to setvalue!(u, x)

setvalue! : (%, S) -> S if % has shallowlyMutable

setvalue!(u, x) sets the value of node u to x.

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

value(u) returns the value of the node u.

~= : (%, %) -> Boolean if S has SetCategory or S has BasicType and % has finiteAggregate
from BasicType

BasicType

CoercibleTo(OutputForm)

HomogeneousAggregate(S)

SetCategory

Aggregate

InnerEvalable(S, S)

Evalable(S)