[CM] A question of methods
cristopher pierson ewing
cewing@u.washington.edu
Thu, 26 Sep 2002 21:29:55 -0700 (PDT)
Okay, another CLOS question:
I have an object (let's call it a cue) with a slot that is a list of
times (let's call the slot goals), I wish to ensure, any time that the
slot value of goals is changed in any cue, that the resulting list is
in chronological order.
So, for example:
(setf my-cue (make-instance 'cue :goals '(1 2 3 4)))
(slot-value my-cue 'goals)
-> (1 2 3 4)
(setf (slot-value my-cue 'goals)
(append (slot-value my-cue 'goals '(1.5 2.5 3.5))))
would normally return
-> (1 2 3 4 1.5 2.5 3.5)
but since i'd created this nifty method, it would instead return
-> (1 1.5 2 2.5 3 3.5 4)
Any ideas how to do this? I understand that you can set methods to happen
:before and :after and so on, but i'm not sure how exactly to do that.
Any help is greatly appreciated!
Cris
********************************
Cris Ewing
CARTAH Assistant
University of Washington
Home Phone: (206) 365-3413
E-mail: cewing@u.washington.edu
*******************************