Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: semi-OT: Lisp code

by runrig (Abbot)
on Apr 01, 2003 at 18:31 UTC ( [id://247299]=note: print w/replies, xml ) Need Help??

in reply to semi-OT: Lisp code
in thread OO, Class::MethodMaker, and get_set

Maybe there's something out there that implements something akin to Lisp's :after methods in Perl that would do what you want.
Well, there is Hook::LexWrap. But if what I read elsewhere in this thread is true (that we assume the computation of 'C' is expensive and we'd like to cache it), then you'd just want to clear the 'C' cache when you change 'A' or 'B', and when you request 'C', just return the cached value if it exists, else compute, cache, and return it.

Replies are listed 'Best First'.
Re: Re: semi-OT: Lisp code
by hding (Chaplain) on Apr 01, 2003 at 18:37 UTC

    This is true. I was just trying to implement something as close as possible to what the original poster asked for with respect to his toy problem, which was recomputation of c whenever a or b was set. Of course it's be easy to modify things to use a cache; e.g. set c to nil (or some other convenient marker) whenever a or b is set and put a :before method on the method c that computes and sets the slot c it if it is nil.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://247299]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-07-16 11:40 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.