Robert Smith quad@symbo1ics.com writes:
Good style remarks, I suppose, which I can change.
On Sat, Feb 23, 2013 at 8:08 AM, Stas Boukarev stassats@gmail.com wrote:
And I don't quite understand the purpose of (unless (eq first plist) (setf (cddr plist) first))
The point of that was for more DWIMness.
Without it, we have:
CL-USER> (let ((x (list :a 1 :b 2 :c 3 :d 4))) (print (delete-from-plist x :a :b :c)) x)
(:D 4) (:A 1 :B 2 :C 3 :D 4)
And with it, we have:
CL-USER> (let ((x (list :a 1 :b 2 :c 3 :d 4))) (print (delete-from-plist x :a :b :c)) x)
(:D 4) (:A 1 :D 4)
If your typical mode of operation is to (setf x (delete-from...)), then of course either are fine. If your goal is to use DELETE-FROM-PLIST for its side effects, then I think the latter is more useful. In fact, for really simple and efficient imperative maintenance of a plist, just prepend (nil nil), and use the function purely for mutation.
I don't see how (:A 1 :D 4) is useful, it's less wrong, but it's still wrong.