<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ MemoizeFunction</code>( <var class="Arg">function</var>[, <var class="Arg">options</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A function</p>
<p><code class="code">MemoizeFunction</code> returns a function which behaves the same as <var class="Arg">function</var>, except that it caches the return value of <var class="Arg">function</var>. The cache can be flushed by calling <code class="func">FlushCaches</code> (<a href="/home/runner/gap/doc/ref/chap79.html#X87A4316C818B3DE3"><span class="RefLink">Reference: FlushCaches</span></a>).</p>
<p>This function does not promise to never call <var class="Arg">function</var> more than once for any input -- values may be removed if the cache gets too large, or GAP chooses to flush all caches, or if multiple threads try to calculate the same value simultaneously.</p>
<p>The optional second argument is a record which provides a number of configuration options. The following options are supported.</p>
<dl>
<dt><strong class="Mark"><code class="code">flush</code> (default <code class="keyw">true</code>)</strong></dt>
<dd><p>If this is <code class="keyw">true</code>, the cache is emptied whenever <code class="func">FlushCaches</code> (<a href="/home/runner/gap/doc/ref/chap79.html#X87A4316C818B3DE3"><spanclass="RefLink">Reference: FlushCaches</span></a>) is called.</p>
</dd>
<dt><strong class="Mark"><code class="code">contract</code> (defaults to <code class="func">ReturnTrue</code> (<a href="/home/runner/gap/doc/ref/chap5.html#X7DB422A2876CCC4D"><span class="RefLink">Reference: ReturnTrue</span></a>))</strong></dt>
<dd><p>A function that is called on the arguments given to <var class="Arg">function</var>. If this function returns <code class="keyw">false</code>, then <code class="code">errorHandler</code> is called.</p>
</dd>
<dt><strong class="Mark"><code class="code">errorHandler</code> (defaults to none)</strong></dt>
<dd><p>A function to be called when an input that does not fulfil <code class="code">contract</code> is passed to the cache.</p>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.