Memoization Module
Wraps a function in a thread-safe cache, so a repeated call with an equal argument returns the stored result.
Nested modules
| Modules | Description |
|
Holds the Unquote tests of the memoize function. |
Functions and values
| Function or value |
Description
|
Full Usage:
memoize f
Parameters:
'a -> 'b
-
The function to memoize
Returns: 'a -> 'b
Type parameters: 'a, 'b |
Memoize a function
- the memoization is based on a thread-safe
|
Full Usage:
memoize2Int f
Parameters:
'a -> 'b -> 'c
Returns: 'a -> 'b -> 'c
Type parameters: 'a, 'b, 'c (requires equality and equality) |
Thread-safe memoization of a two-argument function, keyed on the pair of argument hash codes.
- thread-safe (ConcurrentDictionary + Lazy:
|
Full Usage:
memoizeBounded maxCount f
Parameters:
int
f : 'a -> 'b
Returns: 'a -> 'b
Type parameters: 'a, 'b (requires equality) |
Memoizes f for at most maxCount distinct arguments, compared by structural equality. A new argument that finds maxCount entries first removes the entries whose value is built; the entries still being built stay, so that concurrent calls with one argument run f once, and the cache can hold more than maxCount entries while they are built. When f raises an exception, the entry is removed so that the next call runs f again. The argument must not be null.
|
Full Usage:
memoizeOne f
Parameters:
'a -> 'b
Returns: 'a -> 'b
Type parameters: 'a, 'b |
Thread-safe single-argument memoization. Behaves exactly like
|
GenPRES