Cache - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

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

Cache

 PermanentIndices
 return a sequence of the permanent indices

 Calling Sequence PermanentIndices( cache )

Parameters

 cache - cache table or procedure: the object whose indices (keys) are to be returned

Description

 • The PermanentIndices command returns the indices 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 keys of the permanent indices from that table are returned.  If the procedure does not have a table, NULL is returned.
 • PermanentIndices returns the indices in the same format as indices, that is, a sequence of lists where the contents of each list is an index of a permanent entry from the table.
 • The PermanentEntries command can be used to get the indices of the permanent entries.
 • For more information on cache tables, see Cache Package.

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[{y}\right]{,}\left[{z}\right]$ (2)
 > $\mathrm{Cache}:-\mathrm{PermanentIndices}\left(\mathrm{c1}\right)$
 $\left[{x}\right]{,}\left[{y}\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)

 See Also