Add memoization statement to __r function