Martin McBride
Nov 28, 2021

--

Probably worth noting that cache should only be used with pure functions (ie functions that always return the same result for the same inputs). Maybe it is too obvious to state, but if you apply cache to none pure functions you will likely get some very serious bugs.

Also, there is nothing wrong with using setrecursionlimit is real code (otherwise your example would be pretty pointless). You have to be careful not to exceed the likely system limits, but that is true of memory usage in general.

--

--

Martin McBride
Martin McBride

No responses yet