memorize the result of a function only once. after that, further calls to the function will not invoke fn anymore, and instead simply return the memorized value.