[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plists and NIL.



    Date: Thursday, 9 July 1987  09:16-EDT
    From: dml at nadc.arpa (D. Loewenstern)

    1) NIL is a symbol.  Like all symbols, it has a plist (see CLtL p.4 for an 
    example).

    2) NIL is a list.

    Therefore, does (SETQ z NIL)

                    (SETF (GETF z :a) :b)

                    z

    return NIL or (:a :b)? (That is, does the property go on NIL's plist or
    directly into the list referenced by z?)

It goes into the list referenced by Z.  Your question seems to imply
an extra level of evaluation, which doesn't occur with GETF.

LISP is wonderful.  It lets you say the same thing many ways.
Here are some incantations and what they do (according to Steele
and DEC-20 Common Lisp I'm using):

These change NIL's property list:
  (SETQ Z NIL)
  (SETF (GET Z :A) :B)
     or
  (SETF (GETF (SYMBOL-PLIST 'NIL) :A) :B)
     or
  (SETF (GET 'NIL :A) :B)
  Note:  (SETF (GETF Z :A) :B) gives Z the value (:A :B)

This attempts to change NIL's value:
  (SETF (GETF NIL :A) :B)

These retrieve properties from NIL's property list:
  (SETQ Z NIL)
  (GET Z :A)
    or
  (GETF (SYMBOL-PLIST 'NIL) :A)
    or
  (GET 'NIL :A)
  Note:  (GETF Z :A) returns NIL (since Z contains an empty
		     propert list)


- Stephen