Lisp HUG Maillist Archive

Re: Querying SETF expansions

Maybe CL:GET-SETF-EXPANSION?  The fourth value is either the result of
expanding the expression or '(setf foo).

CL-USER 17 : 1 > (get-setf-expansion '(car x))
(#:G239852)
(X)
(#:G239851)
(SYSTEM::%RPLACA #:G239852 #:G239851)
(CAR #:G239852)

CL-USER 18 : 1 > (get-setf-expansion '(foo x))
(#:G239854)
(X)
(#:G239853)
(SETF::\"COMMON-LISP-USER\"\ \"FOO\" #:G239853 #:G239854)
(FOO #:G239854)

CL-USER 19 : 1 > (fboundp '(setf foo))
NIL

HTH,
Bill

On 8/4/06, Edi Weitz <edi@agharta.de> wrote:
> If I have defined a SETF /function/ like
>
>   (defun (setf foo) (new-value ...) ...),
>
> then I can check for this function with
>
>   (fboundp '(setf foo)).
>
> However, if I have instead used DEFINE-SETF-EXPANDER or DEFSETF, is
> there a way - portable or not - to find out if such a definition
> exists?  FBOUNDP returns NIL in this case, MACRO-FUNCTION doesn't
> accept general function names as arguments, only symbols.  Anything
> else that I'm missing?  Anything LW-specific maybe?
>
> Thanks,
> Edi.


Re: Querying SETF expansions

On Sat, 5 Aug 2006 15:58:34 -0400, "Bill Atkins" <atkinw@rpi.edu> wrote:

> Maybe CL:GET-SETF-EXPANSION?  The fourth value is either the result
> of expanding the expression or '(setf foo).

Yeah, I thought about that as well.  But that will only work if you
know the signature, otherwise you'll get an error message.  In my case
I'm querying all (exported) symbols for potential definitions, so I
don't know the signature.  In fact, I want to find out what the
signature is, if there is a definition.

Thanks,
Edi.


Updated at: 2020-12-10 08:47 UTC