EltableAggregate(Dom, Im)ΒΆ

aggcat.spad line 783

An eltable aggregate is one which can be viewed as a function. For example, the list [1, 7, 4] can applied to 0, 1, and 2 respectively will return the integers 1, 7, and 4; thus this list may be viewed as mapping 0 to 1, 1 to 7 and 2 to 4. In general, an aggregate can map members of a domain Dom to an image domain Im.

elt: (%, Dom) -> Im
from Eltable(Dom, Im)
elt: (%, Dom, Im) -> Im
elt(u, x, y) applies u to x if x is in the domain of u, and returns y otherwise. For example, if u is a polynomial in x over the rationals, elt(u, n, 0) may define the coefficient of x to the power n, returning 0 when n is out of range.
qelt: (%, Dom) -> Im
qelt(u, x) applies u to x without checking whether x is in the domain of u. If x is not in the domain of u a memory-access violation may occur. If a check on whether x is in the domain of u is required, use the function elt.

Eltable(Dom, Im)