In using define-setf-expander, I have a need of checking whether
the reader-form used to access the place being setfed is bound. There
doesn't seems to be a general function or macro to test this; boundp
tests only variables and only then in the global environment, and
slot-boundp tests slots. Is there a place-bound-p that can be
defined? I have come up with a place-unbound-p
(defmacro place-unbound-p (place)
"Is the place unbound?"
`(typep (nth-value 1 (ignore-errors ,place)) 'cell-error))
It works for my purposes, but seems a little imprecise. Is this the
right way to do it, or is there a better way?
--
Liam
In article <··············@zotz.local>, <···@healy.washington.dc.us> wrote:
>In using define-setf-expander, I have a need of checking whether
>the reader-form used to access the place being setfed is bound. There
>doesn't seems to be a general function or macro to test this; boundp
>tests only variables and only then in the global environment, and
>slot-boundp tests slots. Is there a place-bound-p that can be
>defined? I have come up with a place-unbound-p
>
>(defmacro place-unbound-p (place)
> "Is the place unbound?"
> `(typep (nth-value 1 (ignore-errors ,place)) 'cell-error))
>
>It works for my purposes, but seems a little imprecise. Is this the
>right way to do it, or is there a better way?
There's no standard way to do this. Most data types don't have the concept
of unbound cells; the only standard types that support this are symbols and
CLOS instances.
--
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.