Added memoization to DoubleModList.reduce.