Search code examples
lispcommon-lispplist

How to erase all the properties of a symbol in Common Lisp?


How can I completely erase from memory a property list? Ex.:

(setf (get 'book 'title) "Gone with the Wind")
(setf (get 'book 'author) "Margaret Micheal")
(setf (get 'book 'publisher) "Warner Books")

How do I delete all 'book's properties without calling remprop three times?

I tried to look into the HyperSpec but I couldn't find anything useful.


Solution

  • Found it:

    (setf (symbol-plist 'book) nil)
    

    EDIT: After some searching, I came to the conclusion that modern CL code doesn't use get anymore in favor of getf.