Sujet : Re: callbacks in slot writer
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp comp.lang.schemeDate : 26. Sep 2024, 15:30:11
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd3r5i$7cr0$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
(defun sans (plist &rest keys)
"Returns PLIST with keyword arguments from KEYS removed."
;; stolen from Usenet posting <3247672165664225@naggum.no> by
;; Erik Naggum
(let ((sans ()))
(loop
(let ((tail (nth-value 2 (get-properties plist keys))))
;; this is how it ends
(unless tail
(return (nreconc sans plist)))
;; copy all the unmatched keys
(loop until (eq plist tail) do
(push (pop plist) sans)
(push (pop plist) sans))
;; skip the matched key
(setq plist (cddr plist))))))
Gauche Scheme:
(delete-keywords '(b d) '(a 0 b 1 c 2 d 3))
===>
(a 0 c 2)