Wrap combinatorics memoization caches in let blocks