[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
assq-delete-all patch
From: |
Lars Hansen |
Subject: |
assq-delete-all patch |
Date: |
Wed, 23 Apr 2003 10:29:01 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 |
The built-in function assq ignores elements of the list that are not conses.
But the function assq-delete-all in subr.el fails. IMHO that is
inconsequent.
Therefore I suggest this patch:
(defun assq-delete-all (key alist)
"Delete from ALIST all elements whose car is KEY.
! Return the modified alist."
(let ((tail alist))
(while tail
! (if (eq (car (car tail)) key)
(setq alist (delq (car tail) alist)))
(setq tail (cdr tail)))
alist))
--- 2048,2058 ----
(defun assq-delete-all (key alist)
"Delete from ALIST all elements whose car is KEY.
! Return the modified alist.
! Elements of ALIST that are not conses are ignored."
(let ((tail alist))
(while tail
! (if (and (consp (car tail)) (eq (car (car tail)) key))
(setq alist (delq (car tail) alist)))
(setq tail (cdr tail)))
alist))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- assq-delete-all patch,
Lars Hansen <=