Subject: Re: Setting a property in a symbol.
From: Erik Naggum <>
Date: Sun, 26 May 2002 14:05:58 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Adam Warner
| There is no way using get to distinguish an absent property from one
| whose value is default.

  Yes, there is.  Let the default value be a fresh or unique object.  This
  is pretty obvious, so a much better solution to the whole problem is this
  shadowing redefinition of the standard function:

(shadow 'get)
(defun get (symbol property &optional default)
  (let* ((fresh (cons t t))
         (prop (cl:get symbol property fresh)))
    (if (eq fresh prop)
      (values default nil)
      (values prop t))))

  If this function should not cons, wrap (cons t t) in a load-time-value.
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  70 percent of American adults do not understand the scientific process.