EltableAggregate(Dom, Im)ΒΆ

aggcat.spad line 780 [edit on github]

An eltable aggregate is one which can be viewed as a function. For example, the list [1, 7, 4] can be applied to 1, 2, and 3 respectively and will return the integers 1, 7, and 4; thus this list may be viewed as mapping 1 to 1, 2 to 7 and 3 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.

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.

qsetelt!: (%, Dom, Im) -> Im if % has shallowlyMutable

qsetelt!(u, x, y) sets the image of x to be y under u, without checking that x is in the domain of u. If such a check is required use the function setelt!.

setelt!: (%, Dom, Im) -> Im if % has shallowlyMutable

setelt!(u, x, y) sets the image of x to be y under u, if x is in the domain of u. Error: if x is not in the domain of u.

Eltable(Dom, Im)