2.8 memoize
(require sicm/general/memoize) | package: rktsicm |
Memoize has functions for momoization. It also exports some control functions to get statistics on the memoized functions.
The memoized functions generated have the same arity as the original. If the original function was an apply-hook, the memoized function will also be so, with the same apply-hook-extra’s. And any eq-properties that the original function had will also be copied to the new memoized function. None of the memoizers here defined work out of the box for functions that take keyword arguments.
procedure
(samritchie-memoizer func) → procedure?
func : procedure?
procedure
(linear-memoize func [table-size finder]) → procedure?
func : procedure? table-size : integer? = 12 finder : (-> any/c any/c any/c) = weak-find-equal-args?
value
value
value
procedure
procedure
(the-memoizers) → (listof memoizer)
struct
fun : procedure? org : procedure? type : symbol? max-table-size : integer? info : (-> (list integer? integer? any/c)) reset : (-> void)
memoizer-info returns a list that consist of two integers, showing how many hits and misses the memoized function has had, and a third argument that holds info about the internal memory of the memoized function.
memoizer-reset returns a function to reset the memory of the memoized function.