Cache - Maple Programming Help

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

Cache

 TemporaryIndices
 return a sequence of the temporary indices

 Calling Sequence TemporaryIndices( cache )

Parameters

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

Description

 • The TemporaryIndices command returns the temporary indices 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 temporary indices from that table are returned.  If the procedure does not have a remember table, NULL is returned.
 • TemporaryIndices returns the indices in same format as indices, that is, a sequence of lists where the contents of each list is the key of a temporary entry from the table.
 • The TemporaryEntries command can be used to get the values of the temporary entries.

Examples

 > $\mathrm{c1}≔\mathrm{Cache}\left(\right)$
 ${\mathrm{c1}}{≔}{\mathrm{Cache}}{}\left({512}\right)$ (1)
 > $\mathrm{c1}\left[1\right]≔2$
 ${{\mathrm{c1}}}_{{1}}{≔}{2}$ (2)
 > $\mathrm{c1}\left[2\right]≔3$
 ${{\mathrm{c1}}}_{{2}}{≔}{3}$ (3)
 > $\mathrm{Cache}:-\mathrm{TemporaryEntries}\left(\mathrm{c1}\right)$
 $\left[{2}\right]{,}\left[{3}\right]$ (4)
 > $\mathrm{Cache}:-\mathrm{TemporaryIndices}\left(\mathrm{c1}\right)$
 $\left[{1}\right]{,}\left[{2}\right]$ (5)
 > 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}}$ (6)
 > $p\left(2\right)$
 ${4}$ (7)
 > $p\left(3\right)$
 ${9}$ (8)
 > $\mathrm{Cache}:-\mathrm{TemporaryEntries}\left(p\right)$
 $\left[{4}\right]{,}\left[{9}\right]$ (9)
 > $\mathrm{Cache}:-\mathrm{TemporaryIndices}\left(p\right)$
 $\left[{2}\right]{,}\left[{3}\right]$ (10)