define memoized procedure easily