implementing memoized-lambda