memoize bottom-up with-local-vars or recursion fn take memoized itself as first arg