Here is a simple example of caching a computation in a CacheTable, using the augmented null coalescing operator ??=.
|
|
|
|
|
|
In the example above, the function is only executed if M.cache.pdim' is not already defined, and once it is executed the result is stored there for future reference.
In more complicated situations, one may need to create a new table under cache first.
|
The source of this document is in Macaulay2Doc/ov_caching.m2:71:0.