Mercurial > hg > xemacs-beta
comparison lisp/subr.el @ 5468:a9094f28f9a9
Merge with trunk.
author | Mats Lidell <matsl@xemacs.org> |
---|---|
date | Wed, 19 Jan 2011 22:35:23 +0100 |
parents | 89331fa1c819 8608eadee6ba |
children | ac37a5f7e5be |
comparison
equal
deleted
inserted
replaced
5457:4ed2dedf36a1 | 5468:a9094f28f9a9 |
---|---|
144 `(if (fboundp ,(car args)) | 144 `(if (fboundp ,(car args)) |
145 nil | 145 nil |
146 (define-function ,@args))) | 146 (define-function ,@args))) |
147 | 147 |
148 | 148 |
149 (defun delete (item sequence) | |
150 "Delete by side effect any occurrences of ITEM as a member of SEQUENCE. | |
151 | |
152 The modified SEQUENCE is returned. Comparison is done with `equal'. | |
153 | |
154 If the first member of a list SEQUENCE is ITEM, there is no way to remove it | |
155 by side effect; therefore, write `(setq foo (delete element foo))' to be | |
156 sure of changing the value of `foo'. Also see: `remove'." | |
157 (delete* item sequence :test #'equal)) | |
158 | |
159 (defun delq (item sequence) | |
160 "Delete by side effect any occurrences of ITEM as a member of SEQUENCE. | |
161 | |
162 The modified SEQUENCE is returned. Comparison is done with `eq'. If | |
163 SEQUENCE is a list and its first member is ITEM, there is no way to remove | |
164 it by side effect; therefore, write `(setq foo (delq element foo))' to be | |
165 sure of changing the value of `foo'." | |
166 (delete* item sequence :test #'eq)) | |
167 | |
168 (defun remove (item sequence) | |
169 "Remove all occurrences of ITEM in SEQUENCE, testing with `equal'. | |
170 | |
171 This is a non-destructive function; it makes a copy of SEQUENCE if necessary | |
172 to avoid corrupting the original SEQUENCE. | |
173 Also see: `remove*', `delete', `delete*'" | |
174 (remove* item sequence :test #'equal)) | |
175 | |
176 (defun remq (item sequence) | |
177 "Remove all occurrences of ITEM in SEQUENCE, comparing with `eq'. | |
178 | |
179 This is a non-destructive function; it makes a copy of SEQUENCE to avoid | |
180 corrupting the original SEQUENCE. See also the more general `remove*'." | |
181 (remove* item sequence :test #'eq)) | |
182 | |
149 (defun assoc-default (key alist &optional test default) | 183 (defun assoc-default (key alist &optional test default) |
150 "Find object KEY in a pseudo-alist ALIST. | 184 "Find object KEY in a pseudo-alist ALIST. |
151 ALIST is a list of conses or objects. Each element (or the element's car, | 185 ALIST is a list of conses or objects. Each element (or the element's car, |
152 if it is a cons) is compared with KEY by evaluating (TEST (car elt) KEY). | 186 if it is a cons) is compared with KEY by evaluating (TEST (car elt) KEY). |
153 If that is non-nil, the element matches; | 187 If that is non-nil, the element matches; |