# DoublyLinkedAggregate SΒΆ

aggcat.spad line 1251 [edit on github]

S: Type

A doubly-linked aggregate serves as a model for a doubly-linked list, that is, a list which has links to both next and previous nodes and thus can be efficiently traversed in both directions.

- #: % -> NonNegativeInteger if % has finiteAggregate
from Aggregate

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

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

- any?: (S -> Boolean, %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate S

- child?: (%, %) -> Boolean if S has BasicType
from RecursiveAggregate S

- children: % -> List %
from RecursiveAggregate S

- coerce: % -> OutputForm if S has CoercibleTo OutputForm
from CoercibleTo OutputForm

- concat!: (%, %) -> % if % has shallowlyMutable
`concat!(u, v)`

destructively concatenates doubly-linked aggregate`v`

to the end of doubly-linked aggregate`u`

.

- count: (S -> Boolean, %) -> NonNegativeInteger if % has finiteAggregate
from HomogeneousAggregate S

- count: (S, %) -> NonNegativeInteger if S has BasicType and % has finiteAggregate
from HomogeneousAggregate S

- cyclic?: % -> Boolean
from RecursiveAggregate S

- distance: (%, %) -> Integer
from RecursiveAggregate S

- elt: (%, value) -> S
from RecursiveAggregate S

- eval: (%, Equation S) -> % if S has Evalable S and S has SetCategory
from Evalable S

- eval: (%, List 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: (%, S, S) -> % if S has Evalable S and S has SetCategory
from InnerEvalable(S, S)

- every?: (S -> Boolean, %) -> Boolean if % has finiteAggregate
from HomogeneousAggregate S

- head: % -> %
`head(l)`

returns the first element of a doubly-linked aggregate`l`

. Error: if`l`

is empty.

- last: % -> S
`last(l)`

returns the last element of a doubly-linked aggregate`l`

. Error: if`l`

is empty.

- latex: % -> String if S has SetCategory
from SetCategory

- leaf?: % -> Boolean
from RecursiveAggregate S

- leaves: % -> List S
from RecursiveAggregate S

- 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 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

- next: % -> %
`next(l)`

returns the doubly-linked aggregate beginning with its next element. Error: if`l`

has no next element. Note:`next(l) = rest(l)`

and`previous(next(l)) = l`

.

- node?: (%, %) -> Boolean if S has BasicType
from RecursiveAggregate S

- nodes: % -> List %
from RecursiveAggregate S

- parts: % -> List S if % has finiteAggregate
from HomogeneousAggregate S

- previous: % -> %
`previous(l)`

returns the doubly-link list beginning with its previous element. Error: if`l`

has no previous element. Note:`next(previous(l)) = l`

.

- setchildren!: (%, List %) -> % if % has shallowlyMutable
from RecursiveAggregate S

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

- setnext!: (%, %) -> % if % has shallowlyMutable
`setnext!(u, v)`

destructively sets the next node of doubly-linked aggregate`u`

to`v`

, returning`v`

.

- setprevious!: (%, %) -> % if % has shallowlyMutable
`setprevious!(u, v)`

destructively sets the previous node of doubly-linked aggregate`u`

to`v`

, returning`v`

.

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

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

- tail: % -> %
`tail(l)`

returns the doubly-linked aggregate`l`

starting at its second element. Error: if`l`

is empty.

- value: % -> S
from RecursiveAggregate S

BasicType if S has SetCategory or S has BasicType and % has finiteAggregate

CoercibleTo OutputForm if S has CoercibleTo OutputForm

Evalable S if S has Evalable S and S has SetCategory

InnerEvalable(S, S) if S has Evalable S and S has SetCategory

SetCategory if S has SetCategory