[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is it safe to modify a property list directly with PLIST-PUT?
From: |
Teemu Likonen |
Subject: |
Is it safe to modify a property list directly with PLIST-PUT? |
Date: |
Sun, 26 Jul 2009 19:38:40 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
I use a list of property lists to store data. It's like this:
(setq my-data '((:foo "one" :bar "two")
(:foo "three" :bar "four")))
Sometimes I need to modify the data and a command like this seems to
work:
(plist-put (nth 1 my-data) :bar "New value")
That is, PLIST-PUT modifies the property list and variable MY-DATA
contains now the modified list:
((:foo "one" :bar "two")
(:foo "three" :bar "New value"))
The question: Is this reliable? Is it guaranteed that it will always
modify the list correctly? If not, how would you suggest doing it
instead?
Common Lisp has so nice SETF macro...
- Is it safe to modify a property list directly with PLIST-PUT?,
Teemu Likonen <=