<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Remember tables</title>
    <link>http://www.mapleprimes.com/questions/141267-Remember-Tables</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 21:33:42 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 21:33:42 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Remember tables</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Remember tables</title>
      <link>http://www.mapleprimes.com/questions/141267-Remember-Tables</link>
    </image>
    <item>
      <title>Records are mutable</title>
      <link>http://www.mapleprimes.com/questions/141267-Remember-Tables?ref=Feed:MaplePrimes:Remember tables:Comments#answer141270</link>
      <itunes:summary>&lt;p&gt;Records are mutable, as the following shows:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;restart;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:= Record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;B:= Record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;T[A]:= 1: T[B]:= 2:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;eval(T);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; table([B = 2, A = 1])&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Compare that with what happens with an immutable structure, in this case an unevaluated function call (named `record`, just for fun):&lt;br&gt;&lt;br&gt;&lt;strong&gt;restart;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:= record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;B:= record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;T[A]:= 1: T[B]:= 2:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;eval(T);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; table([record(a = 1) = 2])&lt;/p&gt;
&lt;p&gt;But that doesn't mean that they absolutely can't be used with remember tables. If the records being compared are address identical, not just copies which "just happen to be" equal, then the remember table will recognize them. If just a few cases slip through unrecognized because they just happen to be equal, it won't ruin your recursion. On the other hand, if your algorithm relies on making copies of records (not just copying the address, or pointer), the remember table won't work.&lt;/p&gt;
&lt;p&gt;Cache tables, remember tables, and just-plain tables all function like the tables in the examples above. The only difference that cache tables have is that the amount of memory that they use can be easily controlled.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Records are mutable, as the following shows:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;restart;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:= Record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;B:= Record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;T[A]:= 1: T[B]:= 2:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;eval(T);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; table([B = 2, A = 1])&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Compare that with what happens with an immutable structure, in this case an unevaluated function call (named `record`, just for fun):&lt;br&gt;&lt;br&gt;&lt;strong&gt;restart;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:= record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;B:= record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;T[A]:= 1: T[B]:= 2:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;eval(T);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; table([record(a = 1) = 2])&lt;/p&gt;
&lt;p&gt;But that doesn't mean that they absolutely can't be used with remember tables. If the records being compared are address identical, not just copies which "just happen to be" equal, then the remember table will recognize them. If just a few cases slip through unrecognized because they just happen to be equal, it won't ruin your recursion. On the other hand, if your algorithm relies on making copies of records (not just copying the address, or pointer), the remember table won't work.&lt;/p&gt;
&lt;p&gt;Cache tables, remember tables, and just-plain tables all function like the tables in the examples above. The only difference that cache tables have is that the amount of memory that they use can be easily controlled.&lt;/p&gt;</description>
      <guid>141270</guid>
      <pubDate>Sun, 09 Dec 2012 07:16:23 Z</pubDate>
      <itunes:author>Carl Love</itunes:author>
      <author>Carl Love</author>
    </item>
    <item>
      <title>Another example of mutability</title>
      <link>http://www.mapleprimes.com/questions/141267-Remember-Tables?ref=Feed:MaplePrimes:Remember tables:Comments#comment141308</link>
      <itunes:summary>&lt;p&gt;The example above showed that two &lt;strong&gt;Record&lt;/strong&gt;s which seem identical but are stored at different addresses will be stored as separate entries in the table---which may slow down the recursion, but won't cause a real error. The following example---of the converse situation: different &lt;strong&gt;Record&lt;/strong&gt;s, same address---is more insidious.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;restart;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:= Record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;T[eval(A)]:= 1:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:-a:= 2:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;eval(T);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table([Record(a = 2) = 1])&lt;/p&gt;
&lt;p&gt;So even though the record has changed, the value associated with it in the table has not. This situation would cause a procedure that used a remember table on &lt;strong&gt;Record&lt;/strong&gt; arguments to give wrong results.&lt;/p&gt;
&lt;p&gt;There is a way that cache tables might help, though it wouldn't usually be worth it: If the situation in the example immediately above was relatively rare, then you could clear the cache every time you changed the contents of a record.&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;The example above showed that two &lt;strong&gt;Record&lt;/strong&gt;s which seem identical but are stored at different addresses will be stored as separate entries in the table---which may slow down the recursion, but won't cause a real error. The following example---of the converse situation: different &lt;strong&gt;Record&lt;/strong&gt;s, same address---is more insidious.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;restart;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:= Record(a=1):&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;T[eval(A)]:= 1:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;A:-a:= 2:&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;eval(T);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table([Record(a = 2) = 1])&lt;/p&gt;
&lt;p&gt;So even though the record has changed, the value associated with it in the table has not. This situation would cause a procedure that used a remember table on &lt;strong&gt;Record&lt;/strong&gt; arguments to give wrong results.&lt;/p&gt;
&lt;p&gt;There is a way that cache tables might help, though it wouldn't usually be worth it: If the situation in the example immediately above was relatively rare, then you could clear the cache every time you changed the contents of a record.&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;</description>
      <guid>141308</guid>
      <pubDate>Mon, 10 Dec 2012 05:05:01 Z</pubDate>
      <itunes:author>Carl Love</itunes:author>
      <author>Carl Love</author>
    </item>
    <item>
      <title>@Carl Love Yes, your 2nd example demonstrates</title>
      <link>http://www.mapleprimes.com/questions/141267-Remember-Tables?ref=Feed:MaplePrimes:Remember tables:Comments#comment141310</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/141267-Remember-Tables#comment141308"&gt;@Carl Love&lt;/a&gt; Yes, your 2nd example demonstrates what I have already seen in a different context: changing field-contents of a record by assignment is a bit dangerous, leading in my case to the whole thing getting out of sync as the fields in my records are interrelated. The moral here is to only use setter routines to change the content of any field, and then making sure it is all done right. Presumably I can then use forget (in the setter routine) to clear the remember table or maybe even just the relevant entries.&lt;/p&gt;
&lt;p&gt;More work is needed but I go the basic structure to work, and the remember option definitely speeds things up.&lt;/p&gt;
&lt;p&gt;Thanks for an illuminating discussion of this topic,&lt;/p&gt;
&lt;p&gt;M. D.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/141267-Remember-Tables#comment141308"&gt;@Carl Love&lt;/a&gt; Yes, your 2nd example demonstrates what I have already seen in a different context: changing field-contents of a record by assignment is a bit dangerous, leading in my case to the whole thing getting out of sync as the fields in my records are interrelated. The moral here is to only use setter routines to change the content of any field, and then making sure it is all done right. Presumably I can then use forget (in the setter routine) to clear the remember table or maybe even just the relevant entries.&lt;/p&gt;
&lt;p&gt;More work is needed but I go the basic structure to work, and the remember option definitely speeds things up.&lt;/p&gt;
&lt;p&gt;Thanks for an illuminating discussion of this topic,&lt;/p&gt;
&lt;p&gt;M. D.&lt;/p&gt;</description>
      <guid>141310</guid>
      <pubDate>Mon, 10 Dec 2012 07:36:32 Z</pubDate>
      <itunes:author>Mac Dude</itunes:author>
      <author>Mac Dude</author>
    </item>
  </channel>
</rss>