Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Return a stored expression if it exists; otherwise, evaluate and store an expression
ResourceFunction["CacheTo"][symbol, key, expr] returns symbol[key] if it exists; otherwise, it evaluates expr, stores it under symbol[key] and returns expr. |
Generate a cache for an expression:
In[1]:= |
Out[1]= |
Recover the cached value:
In[2]:= |
Out[2]= |
In[3]:= |
Out[3]= |
No value for key h:
In[4]:= |
Out[4]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License