Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » hash tables » MutableHashTable » CacheTable
next | previous | forward | backward | up | index | toc

CacheTable -- hash tables for caching

Description

A cache table is a type of mutable hash table designed for caching computed values that may be recalled later. Cache tables are designed so their contents will not participate in any comparisons by the strict comparison operator ===.

i1 : A = { 1, 2, new CacheTable from { 1 => 10,  2 => 20 }}

o1 = {1, 2, CacheTable{...2...}}

o1 : List
i2 : B = { 1, 2, new CacheTable from { 1 => 100, 2 => 200 }}

o2 = {1, 2, CacheTable{...2...}}

o2 : List
i3 : A === B

o3 = true

To that end, any two cache tables with the same class and parent are considered equal to each other and have hash code equal to 0.

i4 : hash A#2

o4 = 0
i5 : hash B#2

o5 = 0

For the programmer

The object CacheTable is a type, with ancestor classes MutableHashTable < HashTable < Thing.


The source of this document is in Macaulay2Doc/ov_caching.m2:71:0.