From: ···@healy.washington.dc.us
Subject: place-bound-p
Date: 
Message-ID: <87n0u6pp2a.fsf@zotz.local>
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 
From: Barry Margolin
Subject: Re: place-bound-p
Date: 
Message-ID: <oX5N8.9$rS5.189@paloalto-snr1.gtei.net>
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.