[aspectl-devel] with-special-function-scope
Pascal Costanza
pc at p-cos.net
Sat Nov 27 14:34:44 UTC 2004
Hi Peter,
Thanks a lot for the inquiry. Unfortunately, I have no immediate good
answer for your question, and I am currently very busy - I have my PhD
defense on Thursday, so please bear with me.
I will get back to this question afterwards as soon as possible.
Pascal
On 27 Nov 2004, at 13:52, ml13 at onlinehome.de wrote:
> Hi,
>
> I am trying to extend the test example to use a special function that
> is recursive.
> As an example, I am defining f(x) to compute the sum of the squares
>> from 0 to x.
>
> When I am trying to dynamically redefining the function to simply add
> 1 to its result, this new definition seems to get called "inside" as
> well.
>
> What do I have to do to get the (assert (eql (f 5) 56))) working??
>
> I am using LispWorks MacOSX by the way.
>
> Thanks for any help,
>
> Peter.
>
> PS: By the way, is there possibly any example existing of the cached
> fibonacci function using the current version of aspectL?
>
> -----------------
>
> (progn
> (define-special-function f (x)
> (:definer f*))
> (defmethod f* ((scope t) x)
> (if (zerop x)
> 0
> (+ (* x x)
> (f (1- x)))))
> (assert (eql (f 5) 55))
>
> (with-special-function-scope (f*)
> (defmethod* f* ((scope dynamic) x)
> (1+ (call-next-method)))
> (assert (eql (f 5) 56)))
> (assert (eql (f 6) 91)))
>
>
>
> _______________________________________________
> aspectl-devel site list
> aspectl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/aspectl-devel
>
>
--
Tyler: "How's that working out for you?"
Jack: "Great."
Tyler: "Keep it up, then."
More information about the Aspectl-devel
mailing list