aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2005-05-20 14:30:34 +0000
committerJuanma Barranquero2005-05-20 14:30:34 +0000
commit47bc4b3fe18e5cdbcd268699ad0cc5183cd33373 (patch)
treed7d2b0fd746cb3647f049ec49dc782b3e0f6877b
parentc651771a6607c4c1059688c026ac021dd19bf911 (diff)
downloademacs-47bc4b3fe18e5cdbcd268699ad0cc5183cd33373.tar.gz
emacs-47bc4b3fe18e5cdbcd268699ad0cc5183cd33373.zip
(reduce, fill, replace, remove*, remove-if, remove-if-not, delete*, delete-if,
delete-if-not, remove-duplicates, delete-duplicates, substitute, substitute-if, substitute-if-not, nsubstitute, nsubstitute-if, nsubstitute-if-not, find, find-if, find-if-not, position, position-if, position-if-not, count, count-if, count-if-not, mismatch, search, sort*, stable-sort, merge, member*, member-if, member-if-not, assoc*, assoc-if, assoc-if-not, rassoc*, rassoc-if, rassoc-if-not, union, nunion, intersection, nintersection, set-difference, nset-difference, set-exclusive-or, nset-exclusive-or, subsetp, subst-if, subst-if-not, nsubst, nsubst-if, nsubst-if-not, sublis, nsublis, tree-equal): Improve argument/docstring consistency.
-rw-r--r--lisp/ChangeLog86
-rw-r--r--lisp/emacs-lisp/cl-seq.el209
2 files changed, 177 insertions, 118 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f26ba678b73..f35eec9e1f0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,20 +1,3 @@
12005-05-20 Lute Kamstra <lute@gnu.org>
2
3 * diff-mode.el (diff-header-face, diff-file-header-face)
4 (diff-index-face, diff-hunk-header-face, diff-removed-face)
5 (diff-added-face, diff-changed-face, diff-function-face)
6 (diff-context-face, diff-nonexistent-face): Put them in the
7 diff-mode customization group.
8
92005-05-20 Stefan Monnier <monnier@iro.umontreal.ca>
10
11 * progmodes/vhdl-mode.el (vhdl-font-lock-match-item): Simplify regexp.
12
13 * progmodes/sh-script.el (sh-mode, sh-get-word): Minor regexp fixes.
14
15 * font-lock.el (lisp-font-lock-keywords-2): Don't error.
16 Minor regexp-optimization.
17
182005-05-20 Carsten Dominik <dominik@science.uva.nl> 12005-05-20 Carsten Dominik <dominik@science.uva.nl>
19 2
20 * textmodes/org.el (org-agenda-toggle-time-grid): New command. 3 * textmodes/org.el (org-agenda-toggle-time-grid): New command.
@@ -22,7 +5,7 @@
22 (org-agenda-add-time-grid-maybe): New function. 5 (org-agenda-add-time-grid-maybe): New function.
23 (org-agenda): Call `org-agenda-add-time-grid-maybe'. 6 (org-agenda): Call `org-agenda-add-time-grid-maybe'.
24 (org-table-create): `dotimes' instead of `mapcar'. 7 (org-table-create): `dotimes' instead of `mapcar'.
25 (org-xor): Simplify implementation. 8 (org-xor): Simplified implementation.
26 (org-agenda): `inhibit-redisplay' turned on. 9 (org-agenda): `inhibit-redisplay' turned on.
27 (org-agenda-change-all-lines): Use `org-format-agenda-item' to get 10 (org-agenda-change-all-lines): Use `org-format-agenda-item' to get
28 a consistent line after a state change. 11 a consistent line after a state change.
@@ -36,7 +19,22 @@
36 19
372005-05-20 Juanma Barranquero <lekktu@gmail.com> 202005-05-20 Juanma Barranquero <lekktu@gmail.com>
38 21
39 * subr.el (send-string, send-region): Remove obsolescence declaration. 22 * emacs-lisp/cl-seq.el (reduce, fill, replace, remove*)
23 (remove-if, remove-if-not, delete*, delete-if, delete-if-not)
24 (remove-duplicates, delete-duplicates, substitute)
25 (substitute-if, substitute-if-not, nsubstitute, nsubstitute-if)
26 (nsubstitute-if-not, find, find-if, find-if-not, position)
27 (position-if, position-if-not, count, count-if, count-if-not)
28 (mismatch, search, sort*, stable-sort, merge, member*)
29 (member-if, member-if-not, assoc*, assoc-if, assoc-if-not)
30 (rassoc*, rassoc-if, rassoc-if-not, union, nunion)
31 (intersection, nintersection, set-difference, nset-difference)
32 (set-exclusive-or, nset-exclusive-or, subsetp, subst-if)
33 (subst-if-not, nsubst, nsubst-if, nsubst-if-not, sublis)
34 (nsublis, tree-equal): Improve argument/docstring consistency.
35
36 * subr.el (send-string, send-region):
37 Remove obsolescence declaration.
40 (window-dot, set-window-dot, read-input, show-buffer) 38 (window-dot, set-window-dot, read-input, show-buffer)
41 (eval-current-buffer, string-to-int): 39 (eval-current-buffer, string-to-int):
42 Add release number to obsolescence declarations. 40 Add release number to obsolescence declarations.
@@ -173,8 +171,8 @@
173 171
1742005-05-18 Jay Belanger <belanger@truman.edu> 1722005-05-18 Jay Belanger <belanger@truman.edu>
175 173
176 * calc/calc-help.el (calc-s-prefix-help): 174 * calc/calc-help.el (calc-s-prefix-help): Add
177 Add `calc-copy-special-constant' to help string. 175 `calc-copy-special-constant' to help string.
178 176
1792005-05-18 Luc Teirlinck <teirllm@auburn.edu> 1772005-05-18 Luc Teirlinck <teirllm@auburn.edu>
180 178
@@ -187,8 +185,8 @@
187 185
1882005-05-18 Carsten Dominik <dominik@science.uva.nl> 1862005-05-18 Carsten Dominik <dominik@science.uva.nl>
189 187
190 * textmodes/reftex-vars.el (reftex-cite-format-builtin): 188 * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
191 Support for jurabib. 189 for jurabib.
192 190
193 * textmodes/reftex.el (featurep): Define aliases for overlay 191 * textmodes/reftex.el (featurep): Define aliases for overlay
194 commands, for XEmacs compatibility, and use these aliases in 192 commands, for XEmacs compatibility, and use these aliases in
@@ -199,8 +197,8 @@
199 (reftex-access-search-path): Use `reftex-uniquify' instead of 197 (reftex-access-search-path): Use `reftex-uniquify' instead of
200 `reftex-uniq' 198 `reftex-uniq'
201 199
202 * textmodes/reftex-sel.el (reftex-select-unmark): 200 * textmodes/reftex-sel.el (reftex-select-unmark): Overlay
203 Overlay `before-string' property modification enables for Emacs as well. 201 `before-string' property modification enables for Emacs as well.
204 (reftex-select-item): Use `reftex-delete-overlay'. 202 (reftex-select-item): Use `reftex-delete-overlay'.
205 (reftex-select-mark): Use `reftex-make-overlay' and 203 (reftex-select-mark): Use `reftex-make-overlay' and
206 `reftex-overlay-put'. 204 `reftex-overlay-put'.
@@ -235,7 +233,8 @@
235 233
236 * progmodes/prolog.el (inferior-prolog-mode): Doc fix. 234 * progmodes/prolog.el (inferior-prolog-mode): Doc fix.
237 (prolog-consult-region): Replace `send-string' by 235 (prolog-consult-region): Replace `send-string' by
238 `process-send-string'; replace `send-region' by `process-send-region'. 236 `process-send-string'; replace `send-region' by
237 `process-send-region'.
239 238
240 * progmodes/delphi.el (delphi-log-msg): 239 * progmodes/delphi.el (delphi-log-msg):
241 Replace `set-window-dot' by `set-window-point'. 240 Replace `set-window-dot' by `set-window-point'.
@@ -266,8 +265,8 @@
266 loop. It should also be more efficient, because first it only 265 loop. It should also be more efficient, because first it only
267 searches for `:', instead of applying the very complex regexp. 266 searches for `:', instead of applying the very complex regexp.
268 (makefile-mode): Cancel `font-lock-support-mode', because blocks 267 (makefile-mode): Cancel `font-lock-support-mode', because blocks
269 to be fontified in one piece can be too long for JIT. 268 to be fontified in one piece can be too long for JIT. Makefiles
270 Makefiles are never *that* big. 269 are never *that* big.
271 270
2722005-05-17 Reiner Steib <Reiner.Steib@gmx.de> 2712005-05-17 Reiner Steib <Reiner.Steib@gmx.de>
273 272
@@ -293,8 +292,8 @@
293 292
2942005-05-16 Daniel Pfeiffer <occitan@esperanto.org> 2932005-05-16 Daniel Pfeiffer <occitan@esperanto.org>
295 294
296 * font-lock.el (lisp-font-lock-keywords-1): 295 * font-lock.el (lisp-font-lock-keywords-1): Set
297 Set `font-lock-negation-char-face' for [^...] char group. 296 `font-lock-negation-char-face' for [^...] char group.
298 (lisp-font-lock-keywords-2): Highlight regexp's \\( \\| \\). 297 (lisp-font-lock-keywords-2): Highlight regexp's \\( \\| \\).
299 298
300 * progmodes/make-mode.el (makefile-dependency-regex): Turn it into 299 * progmodes/make-mode.el (makefile-dependency-regex): Turn it into
@@ -308,10 +307,11 @@
308 might be the same one to be skipped by the initial [^$], leading 307 might be the same one to be skipped by the initial [^$], leading
309 to an overlooked variable use. 308 to an overlooked variable use.
310 (makefile-make-font-lock-keywords): Remove two parameters, which 309 (makefile-make-font-lock-keywords): Remove two parameters, which
311 are now variables that some of the modes set locally. 310 are now variables that some of the modes set locally. Handle
312 Handle dependency and rule action matching through functions, because 311 dependency and rule action matching through functions, because
313 regexps alone match too often. Dependency matching now comes 312 regexps alone match too often. Dependency matching now comes
314 last, so it can check, whether a colon already matched something else. 313 last, so it can check, whether a colon already matched something
314 else.
315 (makefile-mode): Inform that font-lock improves makefile parsing 315 (makefile-mode): Inform that font-lock improves makefile parsing
316 capabilities. 316 capabilities.
317 (makefile-match-dependency, makefile-match-action): New functions. 317 (makefile-match-dependency, makefile-match-action): New functions.
@@ -396,8 +396,8 @@
396 (reftex-bib-sort-year-reverse, reftex-format-citation): 396 (reftex-bib-sort-year-reverse, reftex-format-citation):
397 * textmodes/reftex-parse.el (reftex-init-section-numbers) 397 * textmodes/reftex-parse.el (reftex-init-section-numbers)
398 (reftex-section-number): 398 (reftex-section-number):
399 * textmodes/texinfmt.el (texinfo-paragraphindent): 399 * textmodes/texinfmt.el (texinfo-paragraphindent): Replace
400 Replace `string-to-int' by `string-to-number'. 400 `string-to-int' by `string-to-number'.
401 401
402 * international/latexenc.el: Add page marker to force the "Local 402 * international/latexenc.el: Add page marker to force the "Local
403 Variables:" string out of the last page. 403 Variables:" string out of the last page.
@@ -505,22 +505,23 @@
505 (tramp-pre-connection): Add parameter CHUNKSIZE. Make local 505 (tramp-pre-connection): Add parameter CHUNKSIZE. Make local
506 variable `tramp-chunksize'. Change callees. 506 variable `tramp-chunksize'. Change callees.
507 (tramp-open-connection-setup-interactive-shell): Check remote host 507 (tramp-open-connection-setup-interactive-shell): Check remote host
508 for buggy `send-process-string' implementation. 508 for buggy `send-process-string' implementation. Set
509 Set `tramp-chunksize' if found. Reported by Michael Kifer 509 `tramp-chunksize' if found. Reported by Michael Kifer
510 <kifer@cs.sunysb.edu> (and a lot of other people all the years). 510 <kifer@cs.sunysb.edu> (and a lot of other people all the years).
511 (tramp-handle-shell-command): `insert-buffer' cannot be used 511 (tramp-handle-shell-command): `insert-buffer' cannot be used
512 because the contents of the Tramp buffer is changed before 512 because the contents of the Tramp buffer is changed before
513 insertion (`expand-file' and alike). Reported by Fr,Ai(Bd,Ai(Bric Bothamy 513 insertion (`expand-file' and alike). Reported by Fr,Ai(Bd,Ai(Bric Bothamy
514 <frederic.bothamy@free.fr>. 514 <frederic.bothamy@free.fr>.
515 (tramp-set-auto-save): Actions should be done for Tramp file name 515 (tramp-set-auto-save): Actions should be done for Tramp file name
516 handler only. Ange-FTP has its own auto-save mechanism. 516 handler only. Ange-FTP has its own auto-save mechanism. Reported
517 Reported by Richard G. Bielawski <Richard.G.Bielawski@wellsfargo.com>. 517 by Richard G. Bielawski <Richard.G.Bielawski@wellsfargo.com>.
518 (tramp-set-auto-save-file-modes): Set file modes of 518 (tramp-set-auto-save-file-modes): Set file modes of
519 `buffer-auto-save-file-name' to ?\600 as fallback solution. 519 `buffer-auto-save-file-name' to ?\600 as fallback solution.
520 Reported by Ferenc Wagner <wferi@tba.elte.hu>. 520 Reported by Ferenc Wagner <wferi@tba.elte.hu>.
521 (tramp-bug): Remove obsolete variable. 521 (tramp-bug): Remove obsolete variable.
522 (tramp-append-tramp-buffers): Rewrite partly. More suitable check 522 (tramp-append-tramp-buffers): Rewrite partly. More suitable check
523 for presence of `mml-mode'. Make it running for older Emacsen as well. 523 for presence of `mml-mode'. Make it running for older Emacsen as
524 well.
524 525
5252005-05-14 John Paul Wallington <jpw@pobox.com> 5262005-05-14 John Paul Wallington <jpw@pobox.com>
526 527
@@ -572,14 +573,15 @@
572 573
5732005-05-13 Matt Hodges <MPHodges@member.fsf.org> 5742005-05-13 Matt Hodges <MPHodges@member.fsf.org>
574 575
575 * tmm.el (tmm-get-keymap): Include only active menus and menu items. 576 * tmm.el (tmm-get-keymap): Include only active menus and menu
577 items.
576 578
577 * emacs-lisp/easymenu.el (easy-menu-define): Doc fixes. 579 * emacs-lisp/easymenu.el (easy-menu-define): Doc fixes.
578 580
5792005-05-13 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 5812005-05-13 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
580 582
581 * dired.el (dired-mode): make-variable-buffer-local => 583 * dired.el (dired-mode): make-variable-buffer-local =>
582 make-local-variable. 584 make-local-variable
583 585
5842005-05-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 5862005-05-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
585 587
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index cb202700a00..35403df1d0b 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -125,8 +125,9 @@
125 125
126 126
127(defun reduce (cl-func cl-seq &rest cl-keys) 127(defun reduce (cl-func cl-seq &rest cl-keys)
128 "Reduce two-argument FUNCTION across SEQUENCE. 128 "Reduce two-argument FUNCTION across SEQ.
129Keywords supported: :start :end :from-end :initial-value :key" 129\nKeywords supported: :start :end :from-end :initial-value :key
130\n(fn FUNCTION SEQ [KEYWORD VALUE]...)"
130 (cl-parsing-keywords (:from-end (:start 0) :end :initial-value :key) () 131 (cl-parsing-keywords (:from-end (:start 0) :end :initial-value :key) ()
131 (or (listp cl-seq) (setq cl-seq (append cl-seq nil))) 132 (or (listp cl-seq) (setq cl-seq (append cl-seq nil)))
132 (setq cl-seq (subseq cl-seq cl-start cl-end)) 133 (setq cl-seq (subseq cl-seq cl-start cl-end))
@@ -145,7 +146,8 @@ Keywords supported: :start :end :from-end :initial-value :key"
145 146
146(defun fill (seq item &rest cl-keys) 147(defun fill (seq item &rest cl-keys)
147 "Fill the elements of SEQ with ITEM. 148 "Fill the elements of SEQ with ITEM.
148Keywords supported: :start :end" 149\nKeywords supported: :start :end
150\n(fn SEQ ITEM [KEYWORD VALUE]...)"
149 (cl-parsing-keywords ((:start 0) :end) () 151 (cl-parsing-keywords ((:start 0) :end) ()
150 (if (listp seq) 152 (if (listp seq)
151 (let ((p (nthcdr cl-start seq)) 153 (let ((p (nthcdr cl-start seq))
@@ -164,7 +166,8 @@ Keywords supported: :start :end"
164(defun replace (cl-seq1 cl-seq2 &rest cl-keys) 166(defun replace (cl-seq1 cl-seq2 &rest cl-keys)
165 "Replace the elements of SEQ1 with the elements of SEQ2. 167 "Replace the elements of SEQ1 with the elements of SEQ2.
166SEQ1 is destructively modified, then returned. 168SEQ1 is destructively modified, then returned.
167Keywords supported: :start1 :end1 :start2 :end2" 169\nKeywords supported: :start1 :end1 :start2 :end2
170\n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
168 (cl-parsing-keywords ((:start1 0) :end1 (:start2 0) :end2) () 171 (cl-parsing-keywords ((:start1 0) :end1 (:start2 0) :end2) ()
169 (if (and (eq cl-seq1 cl-seq2) (<= cl-start2 cl-start1)) 172 (if (and (eq cl-seq1 cl-seq2) (<= cl-start2 cl-start1))
170 (or (= cl-start1 cl-start2) 173 (or (= cl-start1 cl-start2)
@@ -206,7 +209,8 @@ Keywords supported: :start1 :end1 :start2 :end2"
206 "Remove all occurrences of ITEM in SEQ. 209 "Remove all occurrences of ITEM in SEQ.
207This is a non-destructive function; it makes a copy of SEQ if necessary 210This is a non-destructive function; it makes a copy of SEQ if necessary
208to avoid corrupting the original SEQ. 211to avoid corrupting the original SEQ.
209Keywords supported: :test :test-not :key :count :start :end :from-end" 212\nKeywords supported: :test :test-not :key :count :start :end :from-end
213\n(fn ITEM SEQ [KEYWORD VALUE]...)"
210 (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end 214 (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
211 (:start 0) :end) () 215 (:start 0) :end) ()
212 (if (<= (or cl-count (setq cl-count 8000000)) 0) 216 (if (<= (or cl-count (setq cl-count 8000000)) 0)
@@ -250,20 +254,23 @@ Keywords supported: :test :test-not :key :count :start :end :from-end"
250 "Remove all items satisfying PREDICATE in SEQ. 254 "Remove all items satisfying PREDICATE in SEQ.
251This is a non-destructive function; it makes a copy of SEQ if necessary 255This is a non-destructive function; it makes a copy of SEQ if necessary
252to avoid corrupting the original SEQ. 256to avoid corrupting the original SEQ.
253Keywords supported: :key :count :start :end :from-end" 257\nKeywords supported: :key :count :start :end :from-end
258\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
254 (apply 'remove* nil cl-list :if cl-pred cl-keys)) 259 (apply 'remove* nil cl-list :if cl-pred cl-keys))
255 260
256(defun remove-if-not (cl-pred cl-list &rest cl-keys) 261(defun remove-if-not (cl-pred cl-list &rest cl-keys)
257 "Remove all items not satisfying PREDICATE in SEQ. 262 "Remove all items not satisfying PREDICATE in SEQ.
258This is a non-destructive function; it makes a copy of SEQ if necessary 263This is a non-destructive function; it makes a copy of SEQ if necessary
259to avoid corrupting the original SEQ. 264to avoid corrupting the original SEQ.
260Keywords supported: :key :count :start :end :from-end" 265\nKeywords supported: :key :count :start :end :from-end
266\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
261 (apply 'remove* nil cl-list :if-not cl-pred cl-keys)) 267 (apply 'remove* nil cl-list :if-not cl-pred cl-keys))
262 268
263(defun delete* (cl-item cl-seq &rest cl-keys) 269(defun delete* (cl-item cl-seq &rest cl-keys)
264 "Remove all occurrences of ITEM in SEQ. 270 "Remove all occurrences of ITEM in SEQ.
265This is a destructive function; it reuses the storage of SEQ whenever possible. 271This is a destructive function; it reuses the storage of SEQ whenever possible.
266Keywords supported: :test :test-not :key :count :start :end :from-end" 272\nKeywords supported: :test :test-not :key :count :start :end :from-end
273\n(fn ITEM SEQ [KEYWORD VALUE]...)"
267 (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end 274 (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
268 (:start 0) :end) () 275 (:start 0) :end) ()
269 (if (<= (or cl-count (setq cl-count 8000000)) 0) 276 (if (<= (or cl-count (setq cl-count 8000000)) 0)
@@ -305,23 +312,27 @@ Keywords supported: :test :test-not :key :count :start :end :from-end"
305(defun delete-if (cl-pred cl-list &rest cl-keys) 312(defun delete-if (cl-pred cl-list &rest cl-keys)
306 "Remove all items satisfying PREDICATE in SEQ. 313 "Remove all items satisfying PREDICATE in SEQ.
307This is a destructive function; it reuses the storage of SEQ whenever possible. 314This is a destructive function; it reuses the storage of SEQ whenever possible.
308Keywords supported: :key :count :start :end :from-end" 315\nKeywords supported: :key :count :start :end :from-end
316\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
309 (apply 'delete* nil cl-list :if cl-pred cl-keys)) 317 (apply 'delete* nil cl-list :if cl-pred cl-keys))
310 318
311(defun delete-if-not (cl-pred cl-list &rest cl-keys) 319(defun delete-if-not (cl-pred cl-list &rest cl-keys)
312 "Remove all items not satisfying PREDICATE in SEQ. 320 "Remove all items not satisfying PREDICATE in SEQ.
313This is a destructive function; it reuses the storage of SEQ whenever possible. 321This is a destructive function; it reuses the storage of SEQ whenever possible.
314Keywords supported: :key :count :start :end :from-end" 322\nKeywords supported: :key :count :start :end :from-end
323\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
315 (apply 'delete* nil cl-list :if-not cl-pred cl-keys)) 324 (apply 'delete* nil cl-list :if-not cl-pred cl-keys))
316 325
317(defun remove-duplicates (cl-seq &rest cl-keys) 326(defun remove-duplicates (cl-seq &rest cl-keys)
318 "Return a copy of SEQ with all duplicate elements removed. 327 "Return a copy of SEQ with all duplicate elements removed.
319Keywords supported: :test :test-not :key :start :end :from-end" 328\nKeywords supported: :test :test-not :key :start :end :from-end
329\n(fn SEQ [KEYWORD VALUE]...)"
320 (cl-delete-duplicates cl-seq cl-keys t)) 330 (cl-delete-duplicates cl-seq cl-keys t))
321 331
322(defun delete-duplicates (cl-seq &rest cl-keys) 332(defun delete-duplicates (cl-seq &rest cl-keys)
323 "Remove all duplicate elements from SEQ (destructively). 333 "Remove all duplicate elements from SEQ (destructively).
324Keywords supported: :test :test-not :key :start :end :from-end" 334\nKeywords supported: :test :test-not :key :start :end :from-end
335\n(fn SEQ [KEYWORD VALUE]...)"
325 (cl-delete-duplicates cl-seq cl-keys nil)) 336 (cl-delete-duplicates cl-seq cl-keys nil))
326 337
327(defun cl-delete-duplicates (cl-seq cl-keys cl-copy) 338(defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
@@ -368,7 +379,8 @@ Keywords supported: :test :test-not :key :start :end :from-end"
368 "Substitute NEW for OLD in SEQ. 379 "Substitute NEW for OLD in SEQ.
369This is a non-destructive function; it makes a copy of SEQ if necessary 380This is a non-destructive function; it makes a copy of SEQ if necessary
370to avoid corrupting the original SEQ. 381to avoid corrupting the original SEQ.
371Keywords supported: :test :test-not :key :count :start :end :from-end" 382\nKeywords supported: :test :test-not :key :count :start :end :from-end
383\n(fn NEW OLD SEQ [KEYWORD VALUE]...)"
372 (cl-parsing-keywords (:test :test-not :key :if :if-not :count 384 (cl-parsing-keywords (:test :test-not :key :if :if-not :count
373 (:start 0) :end :from-end) () 385 (:start 0) :end :from-end) ()
374 (if (or (eq cl-old cl-new) 386 (if (or (eq cl-old cl-new)
@@ -388,20 +400,23 @@ Keywords supported: :test :test-not :key :count :start :end :from-end"
388 "Substitute NEW for all items satisfying PREDICATE in SEQ. 400 "Substitute NEW for all items satisfying PREDICATE in SEQ.
389This is a non-destructive function; it makes a copy of SEQ if necessary 401This is a non-destructive function; it makes a copy of SEQ if necessary
390to avoid corrupting the original SEQ. 402to avoid corrupting the original SEQ.
391Keywords supported: :key :count :start :end :from-end" 403\nKeywords supported: :key :count :start :end :from-end
404\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
392 (apply 'substitute cl-new nil cl-list :if cl-pred cl-keys)) 405 (apply 'substitute cl-new nil cl-list :if cl-pred cl-keys))
393 406
394(defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys) 407(defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
395 "Substitute NEW for all items not satisfying PREDICATE in SEQ. 408 "Substitute NEW for all items not satisfying PREDICATE in SEQ.
396This is a non-destructive function; it makes a copy of SEQ if necessary 409This is a non-destructive function; it makes a copy of SEQ if necessary
397to avoid corrupting the original SEQ. 410to avoid corrupting the original SEQ.
398Keywords supported: :key :count :start :end :from-end" 411\nKeywords supported: :key :count :start :end :from-end
412\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
399 (apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys)) 413 (apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys))
400 414
401(defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys) 415(defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys)
402 "Substitute NEW for OLD in SEQ. 416 "Substitute NEW for OLD in SEQ.
403This is a destructive function; it reuses the storage of SEQ whenever possible. 417This is a destructive function; it reuses the storage of SEQ whenever possible.
404Keywords supported: :test :test-not :key :count :start :end :from-end" 418\nKeywords supported: :test :test-not :key :count :start :end :from-end
419\n(fn NEW OLD SEQ [KEYWORD VALUE]...)"
405 (cl-parsing-keywords (:test :test-not :key :if :if-not :count 420 (cl-parsing-keywords (:test :test-not :key :if :if-not :count
406 (:start 0) :end :from-end) () 421 (:start 0) :end :from-end) ()
407 (or (eq cl-old cl-new) (<= (or cl-count (setq cl-count 8000000)) 0) 422 (or (eq cl-old cl-new) (<= (or cl-count (setq cl-count 8000000)) 0)
@@ -433,38 +448,44 @@ Keywords supported: :test :test-not :key :count :start :end :from-end"
433(defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys) 448(defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys)
434 "Substitute NEW for all items satisfying PREDICATE in SEQ. 449 "Substitute NEW for all items satisfying PREDICATE in SEQ.
435This is a destructive function; it reuses the storage of SEQ whenever possible. 450This is a destructive function; it reuses the storage of SEQ whenever possible.
436Keywords supported: :key :count :start :end :from-end" 451\nKeywords supported: :key :count :start :end :from-end
452\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
437 (apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys)) 453 (apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys))
438 454
439(defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys) 455(defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
440 "Substitute NEW for all items not satisfying PREDICATE in SEQ. 456 "Substitute NEW for all items not satisfying PREDICATE in SEQ.
441This is a destructive function; it reuses the storage of SEQ whenever possible. 457This is a destructive function; it reuses the storage of SEQ whenever possible.
442Keywords supported: :key :count :start :end :from-end" 458\nKeywords supported: :key :count :start :end :from-end
459\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
443 (apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys)) 460 (apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys))
444 461
445(defun find (cl-item cl-seq &rest cl-keys) 462(defun find (cl-item cl-seq &rest cl-keys)
446 "Find the first occurrence of ITEM in LIST. 463 "Find the first occurrence of ITEM in SEQ.
447Return the matching ITEM, or nil if not found. 464Return the matching ITEM, or nil if not found.
448Keywords supported: :test :test-not :key :start :end :from-end" 465\nKeywords supported: :test :test-not :key :start :end :from-end
466\n(fn ITEM SEQ [KEYWORD VALUE]...)"
449 (let ((cl-pos (apply 'position cl-item cl-seq cl-keys))) 467 (let ((cl-pos (apply 'position cl-item cl-seq cl-keys)))
450 (and cl-pos (elt cl-seq cl-pos)))) 468 (and cl-pos (elt cl-seq cl-pos))))
451 469
452(defun find-if (cl-pred cl-list &rest cl-keys) 470(defun find-if (cl-pred cl-list &rest cl-keys)
453 "Find the first item satisfying PREDICATE in LIST. 471 "Find the first item satisfying PREDICATE in SEQ.
454Return the matching ITEM, or nil if not found. 472Return the matching item, or nil if not found.
455Keywords supported: :key :start :end :from-end" 473\nKeywords supported: :key :start :end :from-end
474\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
456 (apply 'find nil cl-list :if cl-pred cl-keys)) 475 (apply 'find nil cl-list :if cl-pred cl-keys))
457 476
458(defun find-if-not (cl-pred cl-list &rest cl-keys) 477(defun find-if-not (cl-pred cl-list &rest cl-keys)
459 "Find the first item not satisfying PREDICATE in LIST. 478 "Find the first item not satisfying PREDICATE in SEQ.
460Return the matching ITEM, or nil if not found. 479Return the matching item, or nil if not found.
461Keywords supported: :key :start :end :from-end" 480\nKeywords supported: :key :start :end :from-end
481\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
462 (apply 'find nil cl-list :if-not cl-pred cl-keys)) 482 (apply 'find nil cl-list :if-not cl-pred cl-keys))
463 483
464(defun position (cl-item cl-seq &rest cl-keys) 484(defun position (cl-item cl-seq &rest cl-keys)
465 "Find the first occurrence of ITEM in LIST. 485 "Find the first occurrence of ITEM in SEQ.
466Return the index of the matching item, or nil if not found. 486Return the index of the matching item, or nil if not found.
467Keywords supported: :test :test-not :key :start :end :from-end" 487\nKeywords supported: :test :test-not :key :start :end :from-end
488\n(fn ITEM SEQ [KEYWORD VALUE]...)"
468 (cl-parsing-keywords (:test :test-not :key :if :if-not 489 (cl-parsing-keywords (:test :test-not :key :if :if-not
469 (:start 0) :end :from-end) () 490 (:start 0) :end :from-end) ()
470 (cl-position cl-item cl-seq cl-start cl-end cl-from-end))) 491 (cl-position cl-item cl-seq cl-start cl-end cl-from-end)))
@@ -491,20 +512,23 @@ Keywords supported: :test :test-not :key :start :end :from-end"
491 (and (< cl-start cl-end) cl-start)))) 512 (and (< cl-start cl-end) cl-start))))
492 513
493(defun position-if (cl-pred cl-list &rest cl-keys) 514(defun position-if (cl-pred cl-list &rest cl-keys)
494 "Find the first item satisfying PREDICATE in LIST. 515 "Find the first item satisfying PREDICATE in SEQ.
495Return the index of the matching item, or nil if not found. 516Return the index of the matching item, or nil if not found.
496Keywords supported: :key :start :end :from-end" 517\nKeywords supported: :key :start :end :from-end
518\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
497 (apply 'position nil cl-list :if cl-pred cl-keys)) 519 (apply 'position nil cl-list :if cl-pred cl-keys))
498 520
499(defun position-if-not (cl-pred cl-list &rest cl-keys) 521(defun position-if-not (cl-pred cl-list &rest cl-keys)
500 "Find the first item not satisfying PREDICATE in LIST. 522 "Find the first item not satisfying PREDICATE in SEQ.
501Return the index of the matching item, or nil if not found. 523Return the index of the matching item, or nil if not found.
502Keywords supported: :key :start :end :from-end" 524\nKeywords supported: :key :start :end :from-end
525\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
503 (apply 'position nil cl-list :if-not cl-pred cl-keys)) 526 (apply 'position nil cl-list :if-not cl-pred cl-keys))
504 527
505(defun count (cl-item cl-seq &rest cl-keys) 528(defun count (cl-item cl-seq &rest cl-keys)
506 "Count the number of occurrences of ITEM in LIST. 529 "Count the number of occurrences of ITEM in SEQ.
507Keywords supported: :test :test-not :key :start :end" 530\nKeywords supported: :test :test-not :key :start :end
531\n(fn ITEM SEQ [KEYWORD VALUE]...)"
508 (cl-parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) () 532 (cl-parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) ()
509 (let ((cl-count 0) cl-x) 533 (let ((cl-count 0) cl-x)
510 (or cl-end (setq cl-end (length cl-seq))) 534 (or cl-end (setq cl-end (length cl-seq)))
@@ -516,20 +540,23 @@ Keywords supported: :test :test-not :key :start :end"
516 cl-count))) 540 cl-count)))
517 541
518(defun count-if (cl-pred cl-list &rest cl-keys) 542(defun count-if (cl-pred cl-list &rest cl-keys)
519 "Count the number of items satisfying PREDICATE in LIST. 543 "Count the number of items satisfying PREDICATE in SEQ.
520Keywords supported: :key :start :end" 544\nKeywords supported: :key :start :end
545\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
521 (apply 'count nil cl-list :if cl-pred cl-keys)) 546 (apply 'count nil cl-list :if cl-pred cl-keys))
522 547
523(defun count-if-not (cl-pred cl-list &rest cl-keys) 548(defun count-if-not (cl-pred cl-list &rest cl-keys)
524 "Count the number of items not satisfying PREDICATE in LIST. 549 "Count the number of items not satisfying PREDICATE in SEQ.
525Keywords supported: :key :start :end" 550\nKeywords supported: :key :start :end
551\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
526 (apply 'count nil cl-list :if-not cl-pred cl-keys)) 552 (apply 'count nil cl-list :if-not cl-pred cl-keys))
527 553
528(defun mismatch (cl-seq1 cl-seq2 &rest cl-keys) 554(defun mismatch (cl-seq1 cl-seq2 &rest cl-keys)
529 "Compare SEQ1 with SEQ2, return index of first mismatching element. 555 "Compare SEQ1 with SEQ2, return index of first mismatching element.
530Return nil if the sequences match. If one sequence is a prefix of the 556Return nil if the sequences match. If one sequence is a prefix of the
531other, the return value indicates the end of the shorter sequence. 557other, the return value indicates the end of the shorter sequence.
532Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end" 558\nKeywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end
559\n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
533 (cl-parsing-keywords (:test :test-not :key :from-end 560 (cl-parsing-keywords (:test :test-not :key :from-end
534 (:start1 0) :end1 (:start2 0) :end2) () 561 (:start1 0) :end1 (:start2 0) :end2) ()
535 (or cl-end1 (setq cl-end1 (length cl-seq1))) 562 (or cl-end1 (setq cl-end1 (length cl-seq1)))
@@ -558,7 +585,8 @@ Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end"
558 "Search for SEQ1 as a subsequence of SEQ2. 585 "Search for SEQ1 as a subsequence of SEQ2.
559Return the index of the leftmost element of the first match found; 586Return the index of the leftmost element of the first match found;
560return nil if there are no matches. 587return nil if there are no matches.
561Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end" 588\nKeywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end
589\n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
562 (cl-parsing-keywords (:test :test-not :key :from-end 590 (cl-parsing-keywords (:test :test-not :key :from-end
563 (:start1 0) :end1 (:start2 0) :end2) () 591 (:start1 0) :end1 (:start2 0) :end2) ()
564 (or cl-end1 (setq cl-end1 (length cl-seq1))) 592 (or cl-end1 (setq cl-end1 (length cl-seq1)))
@@ -580,9 +608,10 @@ Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end"
580 (and (< cl-start2 cl-end2) cl-pos))))) 608 (and (< cl-start2 cl-end2) cl-pos)))))
581 609
582(defun sort* (cl-seq cl-pred &rest cl-keys) 610(defun sort* (cl-seq cl-pred &rest cl-keys)
583 "Sort the argument SEQUENCE according to PREDICATE. 611 "Sort the argument SEQ according to PREDICATE.
584This is a destructive function; it reuses the storage of SEQUENCE if possible. 612This is a destructive function; it reuses the storage of SEQ if possible.
585Keywords supported: :key" 613\nKeywords supported: :key
614\n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
586 (if (nlistp cl-seq) 615 (if (nlistp cl-seq)
587 (replace cl-seq (apply 'sort* (append cl-seq nil) cl-pred cl-keys)) 616 (replace cl-seq (apply 'sort* (append cl-seq nil) cl-pred cl-keys))
588 (cl-parsing-keywords (:key) () 617 (cl-parsing-keywords (:key) ()
@@ -593,16 +622,18 @@ Keywords supported: :key"
593 (funcall cl-key cl-y))))))))) 622 (funcall cl-key cl-y)))))))))
594 623
595(defun stable-sort (cl-seq cl-pred &rest cl-keys) 624(defun stable-sort (cl-seq cl-pred &rest cl-keys)
596 "Sort the argument SEQUENCE stably according to PREDICATE. 625 "Sort the argument SEQ stably according to PREDICATE.
597This is a destructive function; it reuses the storage of SEQUENCE if possible. 626This is a destructive function; it reuses the storage of SEQ if possible.
598Keywords supported: :key" 627\nKeywords supported: :key
628\n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
599 (apply 'sort* cl-seq cl-pred cl-keys)) 629 (apply 'sort* cl-seq cl-pred cl-keys))
600 630
601(defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys) 631(defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys)
602 "Destructively merge the two sequences to produce a new sequence. 632 "Destructively merge the two sequences to produce a new sequence.
603TYPE is the sequence type to return, SEQ1 and SEQ2 are the two 633TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument
604argument sequences, and PRED is a `less-than' predicate on the elements. 634sequences, and PREDICATE is a `less-than' predicate on the elements.
605Keywords supported: :key" 635\nKeywords supported: :key
636\n(fn TYPE SEQ1 SEQ2 PREDICATE [KEYWORD VALUE]...)"
606 (or (listp cl-seq1) (setq cl-seq1 (append cl-seq1 nil))) 637 (or (listp cl-seq1) (setq cl-seq1 (append cl-seq1 nil)))
607 (or (listp cl-seq2) (setq cl-seq2 (append cl-seq2 nil))) 638 (or (listp cl-seq2) (setq cl-seq2 (append cl-seq2 nil)))
608 (cl-parsing-keywords (:key) () 639 (cl-parsing-keywords (:key) ()
@@ -618,7 +649,8 @@ Keywords supported: :key"
618(defun member* (cl-item cl-list &rest cl-keys) 649(defun member* (cl-item cl-list &rest cl-keys)
619 "Find the first occurrence of ITEM in LIST. 650 "Find the first occurrence of ITEM in LIST.
620Return the sublist of LIST whose car is ITEM. 651Return the sublist of LIST whose car is ITEM.
621Keywords supported: :test :test-not :key" 652\nKeywords supported: :test :test-not :key
653\n(fn ITEM LIST [KEYWORD VALUE]...)"
622 (if cl-keys 654 (if cl-keys
623 (cl-parsing-keywords (:test :test-not :key :if :if-not) () 655 (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
624 (while (and cl-list (not (cl-check-test cl-item (car cl-list)))) 656 (while (and cl-list (not (cl-check-test cl-item (car cl-list))))
@@ -631,13 +663,15 @@ Keywords supported: :test :test-not :key"
631(defun member-if (cl-pred cl-list &rest cl-keys) 663(defun member-if (cl-pred cl-list &rest cl-keys)
632 "Find the first item satisfying PREDICATE in LIST. 664 "Find the first item satisfying PREDICATE in LIST.
633Return the sublist of LIST whose car matches. 665Return the sublist of LIST whose car matches.
634Keywords supported: :key" 666\nKeywords supported: :key
667\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
635 (apply 'member* nil cl-list :if cl-pred cl-keys)) 668 (apply 'member* nil cl-list :if cl-pred cl-keys))
636 669
637(defun member-if-not (cl-pred cl-list &rest cl-keys) 670(defun member-if-not (cl-pred cl-list &rest cl-keys)
638 "Find the first item not satisfying PREDICATE in LIST. 671 "Find the first item not satisfying PREDICATE in LIST.
639Return the sublist of LIST whose car matches. 672Return the sublist of LIST whose car matches.
640Keywords supported: :key" 673\nKeywords supported: :key
674\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
641 (apply 'member* nil cl-list :if-not cl-pred cl-keys)) 675 (apply 'member* nil cl-list :if-not cl-pred cl-keys))
642 676
643(defun cl-adjoin (cl-item cl-list &rest cl-keys) 677(defun cl-adjoin (cl-item cl-list &rest cl-keys)
@@ -649,7 +683,8 @@ Keywords supported: :key"
649;;; See compiler macro in cl-macs.el 683;;; See compiler macro in cl-macs.el
650(defun assoc* (cl-item cl-alist &rest cl-keys) 684(defun assoc* (cl-item cl-alist &rest cl-keys)
651 "Find the first item whose car matches ITEM in LIST. 685 "Find the first item whose car matches ITEM in LIST.
652Keywords supported: :test :test-not :key" 686\nKeywords supported: :test :test-not :key
687\n(fn ITEM LIST [KEYWORD VALUE]...)"
653 (if cl-keys 688 (if cl-keys
654 (cl-parsing-keywords (:test :test-not :key :if :if-not) () 689 (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
655 (while (and cl-alist 690 (while (and cl-alist
@@ -663,17 +698,20 @@ Keywords supported: :test :test-not :key"
663 698
664(defun assoc-if (cl-pred cl-list &rest cl-keys) 699(defun assoc-if (cl-pred cl-list &rest cl-keys)
665 "Find the first item whose car satisfies PREDICATE in LIST. 700 "Find the first item whose car satisfies PREDICATE in LIST.
666Keywords supported: :key" 701\nKeywords supported: :key
702\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
667 (apply 'assoc* nil cl-list :if cl-pred cl-keys)) 703 (apply 'assoc* nil cl-list :if cl-pred cl-keys))
668 704
669(defun assoc-if-not (cl-pred cl-list &rest cl-keys) 705(defun assoc-if-not (cl-pred cl-list &rest cl-keys)
670 "Find the first item whose car does not satisfy PREDICATE in LIST. 706 "Find the first item whose car does not satisfy PREDICATE in LIST.
671Keywords supported: :key" 707\nKeywords supported: :key
708\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
672 (apply 'assoc* nil cl-list :if-not cl-pred cl-keys)) 709 (apply 'assoc* nil cl-list :if-not cl-pred cl-keys))
673 710
674(defun rassoc* (cl-item cl-alist &rest cl-keys) 711(defun rassoc* (cl-item cl-alist &rest cl-keys)
675 "Find the first item whose cdr matches ITEM in LIST. 712 "Find the first item whose cdr matches ITEM in LIST.
676Keywords supported: :test :test-not :key" 713\nKeywords supported: :test :test-not :key
714\n(fn ITEM LIST [KEYWORD VALUE]...)"
677 (if (or cl-keys (numberp cl-item)) 715 (if (or cl-keys (numberp cl-item))
678 (cl-parsing-keywords (:test :test-not :key :if :if-not) () 716 (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
679 (while (and cl-alist 717 (while (and cl-alist
@@ -685,12 +723,14 @@ Keywords supported: :test :test-not :key"
685 723
686(defun rassoc-if (cl-pred cl-list &rest cl-keys) 724(defun rassoc-if (cl-pred cl-list &rest cl-keys)
687 "Find the first item whose cdr satisfies PREDICATE in LIST. 725 "Find the first item whose cdr satisfies PREDICATE in LIST.
688Keywords supported: :key" 726\nKeywords supported: :key
727\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
689 (apply 'rassoc* nil cl-list :if cl-pred cl-keys)) 728 (apply 'rassoc* nil cl-list :if cl-pred cl-keys))
690 729
691(defun rassoc-if-not (cl-pred cl-list &rest cl-keys) 730(defun rassoc-if-not (cl-pred cl-list &rest cl-keys)
692 "Find the first item whose cdr does not satisfy PREDICATE in LIST. 731 "Find the first item whose cdr does not satisfy PREDICATE in LIST.
693Keywords supported: :key" 732\nKeywords supported: :key
733\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
694 (apply 'rassoc* nil cl-list :if-not cl-pred cl-keys)) 734 (apply 'rassoc* nil cl-list :if-not cl-pred cl-keys))
695 735
696(defun union (cl-list1 cl-list2 &rest cl-keys) 736(defun union (cl-list1 cl-list2 &rest cl-keys)
@@ -698,7 +738,8 @@ Keywords supported: :key"
698The result list contains all items that appear in either LIST1 or LIST2. 738The result list contains all items that appear in either LIST1 or LIST2.
699This is a non-destructive function; it makes a copy of the data if necessary 739This is a non-destructive function; it makes a copy of the data if necessary
700to avoid corrupting the original LIST1 and LIST2. 740to avoid corrupting the original LIST1 and LIST2.
701Keywords supported: :test :test-not :key" 741\nKeywords supported: :test :test-not :key
742\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
702 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) 743 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
703 ((equal cl-list1 cl-list2) cl-list1) 744 ((equal cl-list1 cl-list2) cl-list1)
704 (t 745 (t
@@ -717,7 +758,8 @@ Keywords supported: :test :test-not :key"
717The result list contains all items that appear in either LIST1 or LIST2. 758The result list contains all items that appear in either LIST1 or LIST2.
718This is a destructive function; it reuses the storage of LIST1 and LIST2 759This is a destructive function; it reuses the storage of LIST1 and LIST2
719whenever possible. 760whenever possible.
720Keywords supported: :test :test-not :key" 761\nKeywords supported: :test :test-not :key
762\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
721 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) 763 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
722 (t (apply 'union cl-list1 cl-list2 cl-keys)))) 764 (t (apply 'union cl-list1 cl-list2 cl-keys))))
723 765
@@ -726,7 +768,8 @@ Keywords supported: :test :test-not :key"
726The result list contains all items that appear in both LIST1 and LIST2. 768The result list contains all items that appear in both LIST1 and LIST2.
727This is a non-destructive function; it makes a copy of the data if necessary 769This is a non-destructive function; it makes a copy of the data if necessary
728to avoid corrupting the original LIST1 and LIST2. 770to avoid corrupting the original LIST1 and LIST2.
729Keywords supported: :test :test-not :key" 771\nKeywords supported: :test :test-not :key
772\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
730 (and cl-list1 cl-list2 773 (and cl-list1 cl-list2
731 (if (equal cl-list1 cl-list2) cl-list1 774 (if (equal cl-list1 cl-list2) cl-list1
732 (cl-parsing-keywords (:key) (:test :test-not) 775 (cl-parsing-keywords (:key) (:test :test-not)
@@ -747,7 +790,8 @@ Keywords supported: :test :test-not :key"
747The result list contains all items that appear in both LIST1 and LIST2. 790The result list contains all items that appear in both LIST1 and LIST2.
748This is a destructive function; it reuses the storage of LIST1 and LIST2 791This is a destructive function; it reuses the storage of LIST1 and LIST2
749whenever possible. 792whenever possible.
750Keywords supported: :test :test-not :key" 793\nKeywords supported: :test :test-not :key
794\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
751 (and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys))) 795 (and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys)))
752 796
753(defun set-difference (cl-list1 cl-list2 &rest cl-keys) 797(defun set-difference (cl-list1 cl-list2 &rest cl-keys)
@@ -755,7 +799,8 @@ Keywords supported: :test :test-not :key"
755The result list contains all items that appear in LIST1 but not LIST2. 799The result list contains all items that appear in LIST1 but not LIST2.
756This is a non-destructive function; it makes a copy of the data if necessary 800This is a non-destructive function; it makes a copy of the data if necessary
757to avoid corrupting the original LIST1 and LIST2. 801to avoid corrupting the original LIST1 and LIST2.
758Keywords supported: :test :test-not :key" 802\nKeywords supported: :test :test-not :key
803\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
759 (if (or (null cl-list1) (null cl-list2)) cl-list1 804 (if (or (null cl-list1) (null cl-list2)) cl-list1
760 (cl-parsing-keywords (:key) (:test :test-not) 805 (cl-parsing-keywords (:key) (:test :test-not)
761 (let ((cl-res nil)) 806 (let ((cl-res nil))
@@ -773,7 +818,8 @@ Keywords supported: :test :test-not :key"
773The result list contains all items that appear in LIST1 but not LIST2. 818The result list contains all items that appear in LIST1 but not LIST2.
774This is a destructive function; it reuses the storage of LIST1 and LIST2 819This is a destructive function; it reuses the storage of LIST1 and LIST2
775whenever possible. 820whenever possible.
776Keywords supported: :test :test-not :key" 821\nKeywords supported: :test :test-not :key
822\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
777 (if (or (null cl-list1) (null cl-list2)) cl-list1 823 (if (or (null cl-list1) (null cl-list2)) cl-list1
778 (apply 'set-difference cl-list1 cl-list2 cl-keys))) 824 (apply 'set-difference cl-list1 cl-list2 cl-keys)))
779 825
@@ -782,7 +828,8 @@ Keywords supported: :test :test-not :key"
782The result list contains all items that appear in exactly one of LIST1, LIST2. 828The result list contains all items that appear in exactly one of LIST1, LIST2.
783This is a non-destructive function; it makes a copy of the data if necessary 829This is a non-destructive function; it makes a copy of the data if necessary
784to avoid corrupting the original LIST1 and LIST2. 830to avoid corrupting the original LIST1 and LIST2.
785Keywords supported: :test :test-not :key" 831\nKeywords supported: :test :test-not :key
832\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
786 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) 833 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
787 ((equal cl-list1 cl-list2) nil) 834 ((equal cl-list1 cl-list2) nil)
788 (t (append (apply 'set-difference cl-list1 cl-list2 cl-keys) 835 (t (append (apply 'set-difference cl-list1 cl-list2 cl-keys)
@@ -793,7 +840,8 @@ Keywords supported: :test :test-not :key"
793The result list contains all items that appear in exactly one of LIST1, LIST2. 840The result list contains all items that appear in exactly one of LIST1, LIST2.
794This is a destructive function; it reuses the storage of LIST1 and LIST2 841This is a destructive function; it reuses the storage of LIST1 and LIST2
795whenever possible. 842whenever possible.
796Keywords supported: :test :test-not :key" 843\nKeywords supported: :test :test-not :key
844\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
797 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) 845 (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
798 ((equal cl-list1 cl-list2) nil) 846 ((equal cl-list1 cl-list2) nil)
799 (t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys) 847 (t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys)
@@ -802,7 +850,8 @@ Keywords supported: :test :test-not :key"
802(defun subsetp (cl-list1 cl-list2 &rest cl-keys) 850(defun subsetp (cl-list1 cl-list2 &rest cl-keys)
803 "Return true if LIST1 is a subset of LIST2. 851 "Return true if LIST1 is a subset of LIST2.
804I.e., if every element of LIST1 also appears in LIST2. 852I.e., if every element of LIST1 also appears in LIST2.
805Keywords supported: :test :test-not :key" 853\nKeywords supported: :test :test-not :key
854\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
806 (cond ((null cl-list1) t) ((null cl-list2) nil) 855 (cond ((null cl-list1) t) ((null cl-list2) nil)
807 ((equal cl-list1 cl-list2) t) 856 ((equal cl-list1 cl-list2) t)
808 (t (cl-parsing-keywords (:key) (:test :test-not) 857 (t (cl-parsing-keywords (:key) (:test :test-not)
@@ -815,38 +864,44 @@ Keywords supported: :test :test-not :key"
815(defun subst-if (cl-new cl-pred cl-tree &rest cl-keys) 864(defun subst-if (cl-new cl-pred cl-tree &rest cl-keys)
816 "Substitute NEW for elements matching PREDICATE in TREE (non-destructively). 865 "Substitute NEW for elements matching PREDICATE in TREE (non-destructively).
817Return a copy of TREE with all matching elements replaced by NEW. 866Return a copy of TREE with all matching elements replaced by NEW.
818Keywords supported: :key" 867\nKeywords supported: :key
868\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
819 (apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) 869 (apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
820 870
821(defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys) 871(defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
822 "Substitute NEW for elts not matching PREDICATE in TREE (non-destructively). 872 "Substitute NEW for elts not matching PREDICATE in TREE (non-destructively).
823Return a copy of TREE with all non-matching elements replaced by NEW. 873Return a copy of TREE with all non-matching elements replaced by NEW.
824Keywords supported: :key" 874\nKeywords supported: :key
875\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
825 (apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) 876 (apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
826 877
827(defun nsubst (cl-new cl-old cl-tree &rest cl-keys) 878(defun nsubst (cl-new cl-old cl-tree &rest cl-keys)
828 "Substitute NEW for OLD everywhere in TREE (destructively). 879 "Substitute NEW for OLD everywhere in TREE (destructively).
829Any element of TREE which is `eql' to OLD is changed to NEW (via a call 880Any element of TREE which is `eql' to OLD is changed to NEW (via a call
830to `setcar'). 881to `setcar').
831Keywords supported: :test :test-not :key" 882\nKeywords supported: :test :test-not :key
883\n(fn NEW OLD TREE [KEYWORD VALUE]...)"
832 (apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys)) 884 (apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys))
833 885
834(defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys) 886(defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys)
835 "Substitute NEW for elements matching PREDICATE in TREE (destructively). 887 "Substitute NEW for elements matching PREDICATE in TREE (destructively).
836Any element of TREE which matches is changed to NEW (via a call to `setcar'). 888Any element of TREE which matches is changed to NEW (via a call to `setcar').
837Keywords supported: :key" 889\nKeywords supported: :key
890\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
838 (apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) 891 (apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
839 892
840(defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys) 893(defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
841 "Substitute NEW for elements not matching PREDICATE in TREE (destructively). 894 "Substitute NEW for elements not matching PREDICATE in TREE (destructively).
842Any element of TREE which matches is changed to NEW (via a call to `setcar'). 895Any element of TREE which matches is changed to NEW (via a call to `setcar').
843Keywords supported: :key" 896\nKeywords supported: :key
897\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
844 (apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) 898 (apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
845 899
846(defun sublis (cl-alist cl-tree &rest cl-keys) 900(defun sublis (cl-alist cl-tree &rest cl-keys)
847 "Perform substitutions indicated by ALIST in TREE (non-destructively). 901 "Perform substitutions indicated by ALIST in TREE (non-destructively).
848Return a copy of TREE with all matching elements replaced. 902Return a copy of TREE with all matching elements replaced.
849Keywords supported: :test :test-not :key" 903\nKeywords supported: :test :test-not :key
904\n(fn ALIST TREE [KEYWORD VALUE]...)"
850 (cl-parsing-keywords (:test :test-not :key :if :if-not) () 905 (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
851 (cl-sublis-rec cl-tree))) 906 (cl-sublis-rec cl-tree)))
852 907
@@ -867,7 +922,8 @@ Keywords supported: :test :test-not :key"
867(defun nsublis (cl-alist cl-tree &rest cl-keys) 922(defun nsublis (cl-alist cl-tree &rest cl-keys)
868 "Perform substitutions indicated by ALIST in TREE (destructively). 923 "Perform substitutions indicated by ALIST in TREE (destructively).
869Any matching element of TREE is changed via a call to `setcar'. 924Any matching element of TREE is changed via a call to `setcar'.
870Keywords supported: :test :test-not :key" 925\nKeywords supported: :test :test-not :key
926\n(fn ALIST TREE [KEYWORD VALUE]...)"
871 (cl-parsing-keywords (:test :test-not :key :if :if-not) () 927 (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
872 (let ((cl-hold (list cl-tree))) 928 (let ((cl-hold (list cl-tree)))
873 (cl-nsublis-rec cl-hold) 929 (cl-nsublis-rec cl-hold)
@@ -888,9 +944,10 @@ Keywords supported: :test :test-not :key"
888 (setq cl-tree (cdr cl-tree)))))) 944 (setq cl-tree (cdr cl-tree))))))
889 945
890(defun tree-equal (cl-x cl-y &rest cl-keys) 946(defun tree-equal (cl-x cl-y &rest cl-keys)
891 "Return t if trees X and Y have `eql' leaves. 947 "Return t if trees TREE1 and TREE2 have `eql' leaves.
892Atoms are compared by `eql'; cons cells are compared recursively. 948Atoms are compared by `eql'; cons cells are compared recursively.
893Keywords supported: :test :test-not :key" 949\nKeywords supported: :test :test-not :key
950\n(fn TREE1 TREE2 [KEYWORD VALUE]...)"
894 (cl-parsing-keywords (:test :test-not :key) () 951 (cl-parsing-keywords (:test :test-not :key) ()
895 (cl-tree-equal-rec cl-x cl-y))) 952 (cl-tree-equal-rec cl-x cl-y)))
896 953