From: David Sletten
Subject: Property list question
Date: 
Message-ID: <jC%Od.97$Tj7.90@twister.socal.rr.com>
CLHS says:
There is no way using get to distinguish an absent property from one 
whose value is default. However, see get-properties.

http://www.lispworks.com/documentation/HyperSpec/Body/f_get.htm

But this seems to work:
(defun hasprop (symbol prop)
   (let ((flag (list 'pung)))
     (not (eq (get symbol prop flag) flag))))

The property list can't possibly have a property whose value is EQ to 
the cons just made in HASPROP. So if that is returned as the 'default' 
value the property must be missing.

Does the spec mean 'no way using GET alone'?

I guess the suggested alternative is something like this:
(defun hasprop (symbol prop)
   (and (get-properties (symbol-plist symbol) (list prop))
        t))

Although this fails if NIL is a property! It seems you have to check the 
3rd value returned by GET-PROPERTIES...

David Sletten
From: Michael Kappert
Subject: Re: Property list question
Date: 
Message-ID: <3748o5F57q8qeU1@individual.net>
Hi,

David Sletten wrote:
> CLHS says:
> There is no way using get to distinguish an absent property from one 
> whose value is default. However, see get-properties.
> 
> http://www.lispworks.com/documentation/HyperSpec/Body/f_get.htm
> 
> But this seems to work:
> (defun hasprop (symbol prop)
>   (let ((flag (list 'pung)))
>     (not (eq (get symbol prop flag) flag))))
> 
> The property list can't possibly have a property whose value is EQ to 
> the cons just made in HASPROP. 
Exactly. ;-)
Iow, your property list can't possibly have a property whose value is 
/the default/ - you have eliminated the use of (predefined)
defaults in your property list altogether.

Michael