Damian Conway wrote:

> we could make it lazy thus:
>
>       sub a_pure_func(Num $n) is lazy returns Num {
>           return $n ** $n
>       }
>
> which would cause any invocation of C<a_pure_func> to cache
> its arguments (probably in a closure) and return a "proxy"
> Num that carries out the computation only when the proxy is
> evaluated.
>

Would it be useful to apply memoization in a similar fashion...

  sub square ( Num $n ) is memo {
        return $n ** $n;
  }

-banjo

Reply via email to