Andreas Davour <anteRUN@updateLIKE.uu.HELLse> wrote:
+---------------
| Pascal Costanza <pc@p-cos.net> writes:
| > P.S.: Well, actually you are somewhat right: Setf itself is a
| > higher-order macro, but that's not something you have to worry about...
|
| I am *not* going to try to understand how SETF is implemented! ;-)
+---------------
O.k., but you should at least try macroexpanding a few of the more
common use cases just to get a feeling of what it *does*. Note that
SETF will freely use undocumented and/or unexported features of your
particular implementation -- but try to resist doing likewise yourself! ;-}
Examples:
> (macroexpand '(setf (car (cdr x)) 123))
(LISP::%RPLACA (CDR X) 123)
T
> (macroexpand '(setf (aref x 12 34) 789))
(LISP::%ASET X 12 34 789)
T
> (macroexpand '(setf (gethash my-key my-ht my-default) new-value))
(LET* ((#:G1585 MY-KEY) (#:G1586 MY-HT) (#:G1587 MY-DEFAULT))
(MULTIPLE-VALUE-BIND (#:G1588)
NEW-VALUE
(LISP::%PUTHASH #:G1585 #:G1586 #:G1588)))
T
>
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607