Commit 4c4361c9 authored by James M. Lawrence's avatar James M. Lawrence Committed by Attila Lendvai
Browse files

Use the original DELETE-FROM-PLIST replacement.

REMF does not remove duplicate keys, and re-scanning
the list for each key is slower.
Signed-off-by: Attila Lendvai's avatarAttila Lendvai <>
parent caf74454
......@@ -279,8 +279,19 @@ not destructively modified. Keys are compared using EQ."
"Just like REMOVE-FROM-PLIST, but this version may destructively modify the
provided plist."
(declare (optimize speed))
(dolist (key keys plist)
(remf plist key)))
(loop with head = plist
with tail = nil ; a nil tail means an empty result so far
for (key . rest) on plist by #'cddr
do (assert rest () "Expected a proper plist, got ~S" plist)
(if (member key keys :test #'eq)
;; skip over this pair
(let ((next (cdr rest)))
(if tail
(setf (cdr tail) next)
(setf head next)))
;; keep this pair
(setf tail rest))
finally (return head)))
(define-modify-macro remove-from-plistf (&rest keys) remove-from-plist
"Modify macro for REMOVE-FROM-PLIST.")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment