Memoize results of an array intersection