Subject: Re: "Setf functions"
From: (Rob Warnock)
Date: Fri, 23 Nov 2007 22:22:21 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Andreas Davour  <anteRUN@updateLIKE.uu.HELLse> wrote:
| Pascal Costanza <> 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! ;-}

    > (macroexpand '(setf (car (cdr x)) 123))

    (LISP::%RPLACA (CDR X) 123)
    > (macroexpand '(setf (aref x 12 34) 789))

    (LISP::%ASET X 12 34 789)
    > (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)
	(LISP::%PUTHASH #:G1585 #:G1586 #:G1588)))


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607