[alexandria-devel] Implementation of DELETE-FROM-PLIST

Stas Boukarev stassats at gmail.com
Sun Feb 24 00:19:15 UTC 2013


Robert Smith <quad at symbo1ics.com> writes:

> How is (:A 1 :D 4) wrong? There is no way to get it to just (:D 4) via
> mutation when passing to a function. If we want to have just (:D 4),
> we will need to either pass in
It's wrong because it's completely useless, why would anyone use
delete-from-plist without using the value returned by it, if the
original list it modifies has the wrong result? Having to prepend two
NILs is just bogus.

Although, that's not true that there's no way to have (:D 4), but the
problem just shifts to when it deletes everything and it's a NIL:

(unless (eq first plist)
  (psetf (car plist) (car first)
         (cdr plist) (cdr first)))

But that part shouldn't be in alexandria (or any sane library, for that
matter) either way, because it encourages erroneous usage, seemingly
doing the right thing, but breaks when it comes to returning NIL.

And there's alexandria:delete-from-plistf for people who are afraid of
an extra SETF.
-- 
With best regards, Stas.




More information about the alexandria-devel mailing list