memoized indirect recursion.