Resize - Maple Help

Cache

 Resize
 resize a cache table

 Calling Sequence Resize( n, c )

Parameters

 n - integer: new size for the cache table c - cache table or procedure: cache table to resize

Description

 • The Resize command creates a new cache table that is a resized version of an existing table.  The new cache table is created so that it can store at least n elements.  If c is a cache table, the new cache table is returned.  If c is a procedure with a cache remember table, the remember table is resized and the new table replaces the old one.  A reference to the new table is returned.
 • All the permanent elements of the existing table are added to the new table.  Each temporary element of the existing table is inserted into the new table.  However, due to the nature of cache tables there is no guarantee that all temporary elements from the existing table will be present in the new table.

Examples

 > $\mathrm{c1}≔\mathrm{Cache}\left(60,\mathrm{permanent}=\left[1=2,2=3\right],\mathrm{temporary}=\left[3=4,4=5\right]\right)$
 ${\mathrm{c1}}{≔}{\mathrm{Cache}}{}\left({64}{,}'{\mathrm{temporary}}'{=}\left[{3}{=}{4}{,}{4}{=}{5}\right]{,}'{\mathrm{permanent}}'{=}\left[{1}{=}{2}{,}{2}{=}{3}\right]\right)$ (1)
 > $\mathrm{c2}≔\mathrm{Cache}:-\mathrm{Resize}\left(200,\mathrm{c1}\right)$
 ${\mathrm{c2}}{≔}{\mathrm{Cache}}{}\left({256}{,}'{\mathrm{temporary}}'{=}\left[{3}{=}{4}{,}{4}{=}{5}\right]{,}'{\mathrm{permanent}}'{=}\left[{1}{=}{2}{,}{2}{=}{3}\right]\right)$ (2)
 > p := proc(x) return 1; end proc;
 ${p}{≔}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{return}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (3)
 > $\mathrm{Cache}\left(\mathrm{c2},\mathrm{procedure}=p\right)$
 ${\mathrm{Cache}}{}\left({256}{,}'{\mathrm{temporary}}'{=}\left[{3}{=}{4}{,}{4}{=}{5}\right]{,}'{\mathrm{permanent}}'{=}\left[{1}{=}{2}{,}{2}{=}{3}\right]\right)$ (4)
 > $p\left(1\right)$
 ${2}$ (5)
 > $p\left(a\right)$
 ${1}$ (6)
 > $\mathrm{Cache}:-\mathrm{Resize}\left(50,p\right)$
 ${\mathrm{Cache}}{}\left({64}{,}'{\mathrm{temporary}}'{=}\left[{3}{=}{4}{,}{4}{=}{5}\right]{,}'{\mathrm{permanent}}'{=}\left[{1}{=}{2}{,}{2}{=}{3}\right]\right)$ (7)
 > $\mathrm{op}\left(4,\mathrm{eval}\left(p\right)\right)$
 ${\mathrm{Cache}}{}\left({64}{,}'{\mathrm{temporary}}'{=}\left[{3}{=}{4}{,}{4}{=}{5}\right]{,}'{\mathrm{permanent}}'{=}\left[{1}{=}{2}{,}{2}{=}{3}\right]\right)$ (8)