I am working in a package on symmetric functions, that sometimes are quite expensive to compute. I use memoization extensively, but what is the correct approach for a package intended for the public to utilize memoization?
Should it be an option passed to the function, i.e. something like
for granular control, or should it be a global package option?
What about private functions not exposed to the user, but used by several public methods?
I somewhat dislikes the global option, as one then has a state to keep track of (breaking the pure functional approach).
Note that I am particularly interested in best convention, or what people do in practice. This situation must have appeared before.