avoiding redundancy in Generalized Reference
From: Frank Buss (fb_at_frank-buss.de)
Date: 10/08/04
- Next message: drewc: "Re: Thoughts on mod_lisp"
- Previous message: Ari Johnson: "Re: Thoughts on mod_lisp"
- Next in thread: Pascal Bourguignon: "Re: avoiding redundancy in Generalized Reference"
- Reply: Pascal Bourguignon: "Re: avoiding redundancy in Generalized Reference"
- Reply: Peter Seibel: "Re: avoiding redundancy in Generalized Reference"
- Reply: Thomas F. Burdick: "Re: avoiding redundancy in Generalized Reference"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 8 Oct 2004 21:04:30 +0000 (UTC)
I have a function like this:
(defun maze-aref (maze x y) (elt (elt maze (1+ (* y 2))) (1+ (* x 2))))
now I can call it for retrieving a value:
(maze-aref maze 4 2)
but setf gives an error:
(setf (maze-aref maze 4 2) #\Space)
so I define the inversion:
(defun (setf maze-aref) (new-stone maze x y)
(setf (elt (elt maze (1+ (* y 2))) (1+ (* x 2)))
new-stone)
new-stone)
now setf works. But how can I avoid the redundancy? Is there a macro or
something which builts the inversion automaticly for simple cases like
this?
-- Frank Buß, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
- Next message: drewc: "Re: Thoughts on mod_lisp"
- Previous message: Ari Johnson: "Re: Thoughts on mod_lisp"
- Next in thread: Pascal Bourguignon: "Re: avoiding redundancy in Generalized Reference"
- Reply: Pascal Bourguignon: "Re: avoiding redundancy in Generalized Reference"
- Reply: Peter Seibel: "Re: avoiding redundancy in Generalized Reference"
- Reply: Thomas F. Burdick: "Re: avoiding redundancy in Generalized Reference"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]