Parameterize the use of memoization.