Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/datastructures/doc/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 14.9.2025 mit Größe 1 kB image not shown  

Quelle  _Chapter_Memoisation.xml   Sprache: XML

 
<?xml version="1.0" encoding="UTF-8"?>

<!-- This is an automatically generated file. -->
<Chapter Label="Chapter_Memoisation">
<Heading>Memoisation</Heading>

<P/>
 <Package>datastructures</Package> provides simple ways to cache return values of pure functions.
<P/>
<Section Label="Chapter_Memoisation_Section_Memoisation_with_HashMap">
<Heading>Memoisation with HashMap</Heading>

<P/>
<ManSection>
  <Func Arg="function [, options]" Name="MemoizeFunction" />
 <Returns>A function
</Returns>
 <Description>
  <C>MemoizeFunction</C> returns a function which behaves the same as <A>function</A>,
  except that it caches the return value of <A>function</A>.
  The cache can be flushed by calling <Ref Func="FlushCaches" BookName="ref"/>.
<P/>
  This function does not promise to never call <A>function</A> 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/>
  The optional second argument is a record which provides a number
  of configuration options. The following options are supported.
  <List>
  <Mark><C>flush</C> (default <K>true</K>)</Mark>
  <Item>
    If this is <K>true</K>, the cache is emptied whenever
    <Ref Func="FlushCaches" BookName="ref"/> is called.
  </Item>
  <Mark><C>contract</C> (defaults to <Ref Func="ReturnTrue" BookName="ref"/>)</Mark>
  <Item>
    A function that is called on the arguments given to <A>function</A>.
    If this function returns <K>false</K>, then <C>errorHandler</C> is
    called.
  </Item>
  <Mark><C>errorHandler</C> (defaults to none)</Mark>
  <Item>
    A function to be called when an input that does not fulfil
    <C>contract</C> is passed to the cache.
  </Item>
  </List>
  <P/>
 </Description>
</ManSection>


</Section>


</Chapter>

96%


¤ Dauer der Verarbeitung: 0.12 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.