Potential fix for issue #232.

The fix is a memoization approach for the expensive recursive
resolveCtx function. Although I'm not 100% confident that the
memoization approach is correct (though intuitively it feels
correct to me), at least all the tests pass ... which I take
to mean that the memoized resolveCtx is properly generating
hygienic code in the known cases. It certainly does that for
the example given in issue #232 without incurring exponential
time.