Cache - Maple Programming Help

Home : Support : Online Help : Programming : Procedures and Functions : Cache Package : Cache/PermanentEntries

Cache

 PermanentEntries
 return a sequence of the permanent entries

 Calling Sequence PermanentEntries( cache )

Parameters

 cache - cache table or procedure: the object whose entries are to be returned

Description

 • The PermanentEntries command returns the values of the permanent entries of the given cache table.  The cache table can be given directly as cache, or cache can refer to a procedure that has, or can have, a cache remember table.  If such a procedure is given and it has a cache remember table, the values of the permanent entries from that table are returned.  If the procedure does not have a table, NULL is returned.
 • PermanentEntries returns the values in the same format as entries, that is, a sequence of lists where the contents of each list is a value from a permanent entry from the table.
 • The PermanentIndices command can be used to get the indices of the permanent entries.

Examples

 > $\mathrm{c1}≔\mathrm{Cache}\left(\right)$
 ${\mathrm{c1}}{≔}{\mathrm{Cache}}{}\left({512}\right)$ (1)
 > $\mathrm{Cache}:-\mathrm{AddPermanent}\left(\mathrm{c1},\left[x\right],y\right)$
 > $\mathrm{Cache}:-\mathrm{AddPermanent}\left(\mathrm{c1},\left[y\right],z\right)$
 > $\mathrm{Cache}:-\mathrm{PermanentEntries}\left(\mathrm{c1}\right)$
 $\left[{z}\right]{,}\left[{y}\right]$ (2)
 > $\mathrm{Cache}:-\mathrm{PermanentIndices}\left(\mathrm{c1}\right)$
 $\left[{y}\right]{,}\left[{x}\right]$ (3)
 > p := proc( x ) option cache; x^2; end proc;
 ${p}{:=}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{option}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{cache}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{x}{^}{2}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (4)
 > $\mathrm{Cache}:-\mathrm{AddPermanent}\left(p,\left[2\right],2\right)$
 > $\mathrm{Cache}:-\mathrm{AddPermanent}\left(p,\left[3\right],3\right)$
 > $\mathrm{Cache}:-\mathrm{PermanentEntries}\left(p\right)$
 $\left[{2}\right]{,}\left[{3}\right]$ (5)
 > $\mathrm{Cache}:-\mathrm{PermanentIndices}\left(p\right)$
 $\left[{2}\right]{,}\left[{3}\right]$ (6)