> Date: Thu, 07 Nov 2002 20:48:50 +1100
> From: Damian Conway <[EMAIL PROTECTED]>
>
> 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.

    sub a_pure_func(Num $n) returns Num {
        class is Num {
            method FETCH { $n * $n } }.new 
    }

Yes?  No?

Luke

Reply via email to