Another version of memo_rec using lazy.