Improve redex enumeration performance.

Now memoizes the sizes in a dependent enumeration. I didn't do extensive performance comparison, but the enumeration tests took about 1/4 the time after the fix.

Also reorganized a bit of the other enumeration code.