diff options
| author | Stefan Monnier | 2007-06-27 18:59:03 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-06-27 18:59:03 +0000 |
| commit | 323698cc6bce999036e929611ae687a1fc3bb08e (patch) | |
| tree | d469b328562615632b75e98a30873a7030a7e14a | |
| parent | ebacfcc69dc1246c5cc6774b05b0de6ad46224d1 (diff) | |
| download | emacs-323698cc6bce999036e929611ae687a1fc3bb08e.tar.gz emacs-323698cc6bce999036e929611ae687a1fc3bb08e.zip | |
Set generated-autoload-file to cl-loaddefs.el.
Add autoload cookies on all defs autoloaded manually in cl.el.
| -rw-r--r-- | lisp/emacs-lisp/cl-seq.el | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index 0027da1f9d2..742d2af2397 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el | |||
| @@ -125,6 +125,7 @@ | |||
| 125 | (defvar cl-key) | 125 | (defvar cl-key) |
| 126 | 126 | ||
| 127 | 127 | ||
| 128 | ;;;###autoload | ||
| 128 | (defun reduce (cl-func cl-seq &rest cl-keys) | 129 | (defun reduce (cl-func cl-seq &rest cl-keys) |
| 129 | "Reduce two-argument FUNCTION across SEQ. | 130 | "Reduce two-argument FUNCTION across SEQ. |
| 130 | \nKeywords supported: :start :end :from-end :initial-value :key | 131 | \nKeywords supported: :start :end :from-end :initial-value :key |
| @@ -145,6 +146,7 @@ | |||
| 145 | (cl-check-key (pop cl-seq)))))) | 146 | (cl-check-key (pop cl-seq)))))) |
| 146 | cl-accum))) | 147 | cl-accum))) |
| 147 | 148 | ||
| 149 | ;;;###autoload | ||
| 148 | (defun fill (seq item &rest cl-keys) | 150 | (defun fill (seq item &rest cl-keys) |
| 149 | "Fill the elements of SEQ with ITEM. | 151 | "Fill the elements of SEQ with ITEM. |
| 150 | \nKeywords supported: :start :end | 152 | \nKeywords supported: :start :end |
| @@ -164,6 +166,7 @@ | |||
| 164 | (setq cl-start (1+ cl-start))))) | 166 | (setq cl-start (1+ cl-start))))) |
| 165 | seq)) | 167 | seq)) |
| 166 | 168 | ||
| 169 | ;;;###autoload | ||
| 167 | (defun replace (cl-seq1 cl-seq2 &rest cl-keys) | 170 | (defun replace (cl-seq1 cl-seq2 &rest cl-keys) |
| 168 | "Replace the elements of SEQ1 with the elements of SEQ2. | 171 | "Replace the elements of SEQ1 with the elements of SEQ2. |
| 169 | SEQ1 is destructively modified, then returned. | 172 | SEQ1 is destructively modified, then returned. |
| @@ -206,6 +209,7 @@ SEQ1 is destructively modified, then returned. | |||
| 206 | (setq cl-start2 (1+ cl-start2) cl-start1 (1+ cl-start1)))))) | 209 | (setq cl-start2 (1+ cl-start2) cl-start1 (1+ cl-start1)))))) |
| 207 | cl-seq1)) | 210 | cl-seq1)) |
| 208 | 211 | ||
| 212 | ;;;###autoload | ||
| 209 | (defun remove* (cl-item cl-seq &rest cl-keys) | 213 | (defun remove* (cl-item cl-seq &rest cl-keys) |
| 210 | "Remove all occurrences of ITEM in SEQ. | 214 | "Remove all occurrences of ITEM in SEQ. |
| 211 | This is a non-destructive function; it makes a copy of SEQ if necessary | 215 | This is a non-destructive function; it makes a copy of SEQ if necessary |
| @@ -251,6 +255,7 @@ to avoid corrupting the original SEQ. | |||
| 251 | cl-seq)) | 255 | cl-seq)) |
| 252 | cl-seq))))) | 256 | cl-seq))))) |
| 253 | 257 | ||
| 258 | ;;;###autoload | ||
| 254 | (defun remove-if (cl-pred cl-list &rest cl-keys) | 259 | (defun remove-if (cl-pred cl-list &rest cl-keys) |
| 255 | "Remove all items satisfying PREDICATE in SEQ. | 260 | "Remove all items satisfying PREDICATE in SEQ. |
| 256 | This is a non-destructive function; it makes a copy of SEQ if necessary | 261 | This is a non-destructive function; it makes a copy of SEQ if necessary |
| @@ -259,6 +264,7 @@ to avoid corrupting the original SEQ. | |||
| 259 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 264 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 260 | (apply 'remove* nil cl-list :if cl-pred cl-keys)) | 265 | (apply 'remove* nil cl-list :if cl-pred cl-keys)) |
| 261 | 266 | ||
| 267 | ;;;###autoload | ||
| 262 | (defun remove-if-not (cl-pred cl-list &rest cl-keys) | 268 | (defun remove-if-not (cl-pred cl-list &rest cl-keys) |
| 263 | "Remove all items not satisfying PREDICATE in SEQ. | 269 | "Remove all items not satisfying PREDICATE in SEQ. |
| 264 | This is a non-destructive function; it makes a copy of SEQ if necessary | 270 | This is a non-destructive function; it makes a copy of SEQ if necessary |
| @@ -267,6 +273,7 @@ to avoid corrupting the original SEQ. | |||
| 267 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 273 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 268 | (apply 'remove* nil cl-list :if-not cl-pred cl-keys)) | 274 | (apply 'remove* nil cl-list :if-not cl-pred cl-keys)) |
| 269 | 275 | ||
| 276 | ;;;###autoload | ||
| 270 | (defun delete* (cl-item cl-seq &rest cl-keys) | 277 | (defun delete* (cl-item cl-seq &rest cl-keys) |
| 271 | "Remove all occurrences of ITEM in SEQ. | 278 | "Remove all occurrences of ITEM in SEQ. |
| 272 | This is a destructive function; it reuses the storage of SEQ whenever possible. | 279 | This is a destructive function; it reuses the storage of SEQ whenever possible. |
| @@ -310,6 +317,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible. | |||
| 310 | cl-seq) | 317 | cl-seq) |
| 311 | (apply 'remove* cl-item cl-seq cl-keys))))) | 318 | (apply 'remove* cl-item cl-seq cl-keys))))) |
| 312 | 319 | ||
| 320 | ;;;###autoload | ||
| 313 | (defun delete-if (cl-pred cl-list &rest cl-keys) | 321 | (defun delete-if (cl-pred cl-list &rest cl-keys) |
| 314 | "Remove all items satisfying PREDICATE in SEQ. | 322 | "Remove all items satisfying PREDICATE in SEQ. |
| 315 | This is a destructive function; it reuses the storage of SEQ whenever possible. | 323 | This is a destructive function; it reuses the storage of SEQ whenever possible. |
| @@ -317,6 +325,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible. | |||
| 317 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 325 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 318 | (apply 'delete* nil cl-list :if cl-pred cl-keys)) | 326 | (apply 'delete* nil cl-list :if cl-pred cl-keys)) |
| 319 | 327 | ||
| 328 | ;;;###autoload | ||
| 320 | (defun delete-if-not (cl-pred cl-list &rest cl-keys) | 329 | (defun delete-if-not (cl-pred cl-list &rest cl-keys) |
| 321 | "Remove all items not satisfying PREDICATE in SEQ. | 330 | "Remove all items not satisfying PREDICATE in SEQ. |
| 322 | This is a destructive function; it reuses the storage of SEQ whenever possible. | 331 | This is a destructive function; it reuses the storage of SEQ whenever possible. |
| @@ -324,12 +333,14 @@ This is a destructive function; it reuses the storage of SEQ whenever possible. | |||
| 324 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 333 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 325 | (apply 'delete* nil cl-list :if-not cl-pred cl-keys)) | 334 | (apply 'delete* nil cl-list :if-not cl-pred cl-keys)) |
| 326 | 335 | ||
| 336 | ;;;###autoload | ||
| 327 | (defun remove-duplicates (cl-seq &rest cl-keys) | 337 | (defun remove-duplicates (cl-seq &rest cl-keys) |
| 328 | "Return a copy of SEQ with all duplicate elements removed. | 338 | "Return a copy of SEQ with all duplicate elements removed. |
| 329 | \nKeywords supported: :test :test-not :key :start :end :from-end | 339 | \nKeywords supported: :test :test-not :key :start :end :from-end |
| 330 | \n(fn SEQ [KEYWORD VALUE]...)" | 340 | \n(fn SEQ [KEYWORD VALUE]...)" |
| 331 | (cl-delete-duplicates cl-seq cl-keys t)) | 341 | (cl-delete-duplicates cl-seq cl-keys t)) |
| 332 | 342 | ||
| 343 | ;;;###autoload | ||
| 333 | (defun delete-duplicates (cl-seq &rest cl-keys) | 344 | (defun delete-duplicates (cl-seq &rest cl-keys) |
| 334 | "Remove all duplicate elements from SEQ (destructively). | 345 | "Remove all duplicate elements from SEQ (destructively). |
| 335 | \nKeywords supported: :test :test-not :key :start :end :from-end | 346 | \nKeywords supported: :test :test-not :key :start :end :from-end |
| @@ -376,6 +387,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible. | |||
| 376 | (let ((cl-res (cl-delete-duplicates (append cl-seq nil) cl-keys nil))) | 387 | (let ((cl-res (cl-delete-duplicates (append cl-seq nil) cl-keys nil))) |
| 377 | (if (stringp cl-seq) (concat cl-res) (vconcat cl-res))))) | 388 | (if (stringp cl-seq) (concat cl-res) (vconcat cl-res))))) |
| 378 | 389 | ||
| 390 | ;;;###autoload | ||
| 379 | (defun substitute (cl-new cl-old cl-seq &rest cl-keys) | 391 | (defun substitute (cl-new cl-old cl-seq &rest cl-keys) |
| 380 | "Substitute NEW for OLD in SEQ. | 392 | "Substitute NEW for OLD in SEQ. |
| 381 | This is a non-destructive function; it makes a copy of SEQ if necessary | 393 | This is a non-destructive function; it makes a copy of SEQ if necessary |
| @@ -397,6 +409,7 @@ to avoid corrupting the original SEQ. | |||
| 397 | (apply 'nsubstitute cl-new cl-old cl-seq :count cl-count | 409 | (apply 'nsubstitute cl-new cl-old cl-seq :count cl-count |
| 398 | :start cl-i cl-keys)))))) | 410 | :start cl-i cl-keys)))))) |
| 399 | 411 | ||
| 412 | ;;;###autoload | ||
| 400 | (defun substitute-if (cl-new cl-pred cl-list &rest cl-keys) | 413 | (defun substitute-if (cl-new cl-pred cl-list &rest cl-keys) |
| 401 | "Substitute NEW for all items satisfying PREDICATE in SEQ. | 414 | "Substitute NEW for all items satisfying PREDICATE in SEQ. |
| 402 | This is a non-destructive function; it makes a copy of SEQ if necessary | 415 | This is a non-destructive function; it makes a copy of SEQ if necessary |
| @@ -405,6 +418,7 @@ to avoid corrupting the original SEQ. | |||
| 405 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" | 418 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" |
| 406 | (apply 'substitute cl-new nil cl-list :if cl-pred cl-keys)) | 419 | (apply 'substitute cl-new nil cl-list :if cl-pred cl-keys)) |
| 407 | 420 | ||
| 421 | ;;;###autoload | ||
| 408 | (defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys) | 422 | (defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys) |
| 409 | "Substitute NEW for all items not satisfying PREDICATE in SEQ. | 423 | "Substitute NEW for all items not satisfying PREDICATE in SEQ. |
| 410 | This is a non-destructive function; it makes a copy of SEQ if necessary | 424 | This is a non-destructive function; it makes a copy of SEQ if necessary |
| @@ -413,6 +427,7 @@ to avoid corrupting the original SEQ. | |||
| 413 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" | 427 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" |
| 414 | (apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys)) | 428 | (apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys)) |
| 415 | 429 | ||
| 430 | ;;;###autoload | ||
| 416 | (defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys) | 431 | (defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys) |
| 417 | "Substitute NEW for OLD in SEQ. | 432 | "Substitute NEW for OLD in SEQ. |
| 418 | This is a destructive function; it reuses the storage of SEQ whenever possible. | 433 | This is a destructive function; it reuses the storage of SEQ whenever possible. |
| @@ -446,6 +461,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible. | |||
| 446 | (setq cl-start (1+ cl-start)))))) | 461 | (setq cl-start (1+ cl-start)))))) |
| 447 | cl-seq)) | 462 | cl-seq)) |
| 448 | 463 | ||
| 464 | ;;;###autoload | ||
| 449 | (defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys) | 465 | (defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys) |
| 450 | "Substitute NEW for all items satisfying PREDICATE in SEQ. | 466 | "Substitute NEW for all items satisfying PREDICATE in SEQ. |
| 451 | This is a destructive function; it reuses the storage of SEQ whenever possible. | 467 | This is a destructive function; it reuses the storage of SEQ whenever possible. |
| @@ -453,6 +469,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible. | |||
| 453 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" | 469 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" |
| 454 | (apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys)) | 470 | (apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys)) |
| 455 | 471 | ||
| 472 | ;;;###autoload | ||
| 456 | (defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys) | 473 | (defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys) |
| 457 | "Substitute NEW for all items not satisfying PREDICATE in SEQ. | 474 | "Substitute NEW for all items not satisfying PREDICATE in SEQ. |
| 458 | This is a destructive function; it reuses the storage of SEQ whenever possible. | 475 | This is a destructive function; it reuses the storage of SEQ whenever possible. |
| @@ -460,6 +477,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible. | |||
| 460 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" | 477 | \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" |
| 461 | (apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys)) | 478 | (apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys)) |
| 462 | 479 | ||
| 480 | ;;;###autoload | ||
| 463 | (defun find (cl-item cl-seq &rest cl-keys) | 481 | (defun find (cl-item cl-seq &rest cl-keys) |
| 464 | "Find the first occurrence of ITEM in SEQ. | 482 | "Find the first occurrence of ITEM in SEQ. |
| 465 | Return the matching ITEM, or nil if not found. | 483 | Return the matching ITEM, or nil if not found. |
| @@ -468,6 +486,7 @@ Return the matching ITEM, or nil if not found. | |||
| 468 | (let ((cl-pos (apply 'position cl-item cl-seq cl-keys))) | 486 | (let ((cl-pos (apply 'position cl-item cl-seq cl-keys))) |
| 469 | (and cl-pos (elt cl-seq cl-pos)))) | 487 | (and cl-pos (elt cl-seq cl-pos)))) |
| 470 | 488 | ||
| 489 | ;;;###autoload | ||
| 471 | (defun find-if (cl-pred cl-list &rest cl-keys) | 490 | (defun find-if (cl-pred cl-list &rest cl-keys) |
| 472 | "Find the first item satisfying PREDICATE in SEQ. | 491 | "Find the first item satisfying PREDICATE in SEQ. |
| 473 | Return the matching item, or nil if not found. | 492 | Return the matching item, or nil if not found. |
| @@ -475,6 +494,7 @@ Return the matching item, or nil if not found. | |||
| 475 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 494 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 476 | (apply 'find nil cl-list :if cl-pred cl-keys)) | 495 | (apply 'find nil cl-list :if cl-pred cl-keys)) |
| 477 | 496 | ||
| 497 | ;;;###autoload | ||
| 478 | (defun find-if-not (cl-pred cl-list &rest cl-keys) | 498 | (defun find-if-not (cl-pred cl-list &rest cl-keys) |
| 479 | "Find the first item not satisfying PREDICATE in SEQ. | 499 | "Find the first item not satisfying PREDICATE in SEQ. |
| 480 | Return the matching item, or nil if not found. | 500 | Return the matching item, or nil if not found. |
| @@ -482,6 +502,7 @@ Return the matching item, or nil if not found. | |||
| 482 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 502 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 483 | (apply 'find nil cl-list :if-not cl-pred cl-keys)) | 503 | (apply 'find nil cl-list :if-not cl-pred cl-keys)) |
| 484 | 504 | ||
| 505 | ;;;###autoload | ||
| 485 | (defun position (cl-item cl-seq &rest cl-keys) | 506 | (defun position (cl-item cl-seq &rest cl-keys) |
| 486 | "Find the first occurrence of ITEM in SEQ. | 507 | "Find the first occurrence of ITEM in SEQ. |
| 487 | Return the index of the matching item, or nil if not found. | 508 | Return the index of the matching item, or nil if not found. |
| @@ -512,6 +533,7 @@ Return the index of the matching item, or nil if not found. | |||
| 512 | (setq cl-start (1+ cl-start))) | 533 | (setq cl-start (1+ cl-start))) |
| 513 | (and (< cl-start cl-end) cl-start)))) | 534 | (and (< cl-start cl-end) cl-start)))) |
| 514 | 535 | ||
| 536 | ;;;###autoload | ||
| 515 | (defun position-if (cl-pred cl-list &rest cl-keys) | 537 | (defun position-if (cl-pred cl-list &rest cl-keys) |
| 516 | "Find the first item satisfying PREDICATE in SEQ. | 538 | "Find the first item satisfying PREDICATE in SEQ. |
| 517 | Return the index of the matching item, or nil if not found. | 539 | Return the index of the matching item, or nil if not found. |
| @@ -519,6 +541,7 @@ Return the index of the matching item, or nil if not found. | |||
| 519 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 541 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 520 | (apply 'position nil cl-list :if cl-pred cl-keys)) | 542 | (apply 'position nil cl-list :if cl-pred cl-keys)) |
| 521 | 543 | ||
| 544 | ;;;###autoload | ||
| 522 | (defun position-if-not (cl-pred cl-list &rest cl-keys) | 545 | (defun position-if-not (cl-pred cl-list &rest cl-keys) |
| 523 | "Find the first item not satisfying PREDICATE in SEQ. | 546 | "Find the first item not satisfying PREDICATE in SEQ. |
| 524 | Return the index of the matching item, or nil if not found. | 547 | Return the index of the matching item, or nil if not found. |
| @@ -526,6 +549,7 @@ Return the index of the matching item, or nil if not found. | |||
| 526 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 549 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 527 | (apply 'position nil cl-list :if-not cl-pred cl-keys)) | 550 | (apply 'position nil cl-list :if-not cl-pred cl-keys)) |
| 528 | 551 | ||
| 552 | ;;;###autoload | ||
| 529 | (defun count (cl-item cl-seq &rest cl-keys) | 553 | (defun count (cl-item cl-seq &rest cl-keys) |
| 530 | "Count the number of occurrences of ITEM in SEQ. | 554 | "Count the number of occurrences of ITEM in SEQ. |
| 531 | \nKeywords supported: :test :test-not :key :start :end | 555 | \nKeywords supported: :test :test-not :key :start :end |
| @@ -540,18 +564,21 @@ Return the index of the matching item, or nil if not found. | |||
| 540 | (setq cl-start (1+ cl-start))) | 564 | (setq cl-start (1+ cl-start))) |
| 541 | cl-count))) | 565 | cl-count))) |
| 542 | 566 | ||
| 567 | ;;;###autoload | ||
| 543 | (defun count-if (cl-pred cl-list &rest cl-keys) | 568 | (defun count-if (cl-pred cl-list &rest cl-keys) |
| 544 | "Count the number of items satisfying PREDICATE in SEQ. | 569 | "Count the number of items satisfying PREDICATE in SEQ. |
| 545 | \nKeywords supported: :key :start :end | 570 | \nKeywords supported: :key :start :end |
| 546 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 571 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 547 | (apply 'count nil cl-list :if cl-pred cl-keys)) | 572 | (apply 'count nil cl-list :if cl-pred cl-keys)) |
| 548 | 573 | ||
| 574 | ;;;###autoload | ||
| 549 | (defun count-if-not (cl-pred cl-list &rest cl-keys) | 575 | (defun count-if-not (cl-pred cl-list &rest cl-keys) |
| 550 | "Count the number of items not satisfying PREDICATE in SEQ. | 576 | "Count the number of items not satisfying PREDICATE in SEQ. |
| 551 | \nKeywords supported: :key :start :end | 577 | \nKeywords supported: :key :start :end |
| 552 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" | 578 | \n(fn PREDICATE SEQ [KEYWORD VALUE]...)" |
| 553 | (apply 'count nil cl-list :if-not cl-pred cl-keys)) | 579 | (apply 'count nil cl-list :if-not cl-pred cl-keys)) |
| 554 | 580 | ||
| 581 | ;;;###autoload | ||
| 555 | (defun mismatch (cl-seq1 cl-seq2 &rest cl-keys) | 582 | (defun mismatch (cl-seq1 cl-seq2 &rest cl-keys) |
| 556 | "Compare SEQ1 with SEQ2, return index of first mismatching element. | 583 | "Compare SEQ1 with SEQ2, return index of first mismatching element. |
| 557 | Return nil if the sequences match. If one sequence is a prefix of the | 584 | Return nil if the sequences match. If one sequence is a prefix of the |
| @@ -582,6 +609,7 @@ other, the return value indicates the end of the shorter sequence. | |||
| 582 | (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2)) | 609 | (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2)) |
| 583 | cl-start1))))) | 610 | cl-start1))))) |
| 584 | 611 | ||
| 612 | ;;;###autoload | ||
| 585 | (defun search (cl-seq1 cl-seq2 &rest cl-keys) | 613 | (defun search (cl-seq1 cl-seq2 &rest cl-keys) |
| 586 | "Search for SEQ1 as a subsequence of SEQ2. | 614 | "Search for SEQ1 as a subsequence of SEQ2. |
| 587 | Return the index of the leftmost element of the first match found; | 615 | Return the index of the leftmost element of the first match found; |
| @@ -608,6 +636,7 @@ return nil if there are no matches. | |||
| 608 | (if cl-from-end (setq cl-end2 cl-pos) (setq cl-start2 (1+ cl-pos)))) | 636 | (if cl-from-end (setq cl-end2 cl-pos) (setq cl-start2 (1+ cl-pos)))) |
| 609 | (and (< cl-start2 cl-end2) cl-pos))))) | 637 | (and (< cl-start2 cl-end2) cl-pos))))) |
| 610 | 638 | ||
| 639 | ;;;###autoload | ||
| 611 | (defun sort* (cl-seq cl-pred &rest cl-keys) | 640 | (defun sort* (cl-seq cl-pred &rest cl-keys) |
| 612 | "Sort the argument SEQ according to PREDICATE. | 641 | "Sort the argument SEQ according to PREDICATE. |
| 613 | This is a destructive function; it reuses the storage of SEQ if possible. | 642 | This is a destructive function; it reuses the storage of SEQ if possible. |
| @@ -622,6 +651,7 @@ This is a destructive function; it reuses the storage of SEQ if possible. | |||
| 622 | (funcall cl-pred (funcall cl-key cl-x) | 651 | (funcall cl-pred (funcall cl-key cl-x) |
| 623 | (funcall cl-key cl-y))))))))) | 652 | (funcall cl-key cl-y))))))))) |
| 624 | 653 | ||
| 654 | ;;;###autoload | ||
| 625 | (defun stable-sort (cl-seq cl-pred &rest cl-keys) | 655 | (defun stable-sort (cl-seq cl-pred &rest cl-keys) |
| 626 | "Sort the argument SEQ stably according to PREDICATE. | 656 | "Sort the argument SEQ stably according to PREDICATE. |
| 627 | This is a destructive function; it reuses the storage of SEQ if possible. | 657 | This is a destructive function; it reuses the storage of SEQ if possible. |
| @@ -629,6 +659,7 @@ This is a destructive function; it reuses the storage of SEQ if possible. | |||
| 629 | \n(fn SEQ PREDICATE [KEYWORD VALUE]...)" | 659 | \n(fn SEQ PREDICATE [KEYWORD VALUE]...)" |
| 630 | (apply 'sort* cl-seq cl-pred cl-keys)) | 660 | (apply 'sort* cl-seq cl-pred cl-keys)) |
| 631 | 661 | ||
| 662 | ;;;###autoload | ||
| 632 | (defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys) | 663 | (defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys) |
| 633 | "Destructively merge the two sequences to produce a new sequence. | 664 | "Destructively merge the two sequences to produce a new sequence. |
| 634 | TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument | 665 | TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument |
| @@ -647,6 +678,7 @@ sequences, and PREDICATE is a `less-than' predicate on the elements. | |||
| 647 | (coerce (nconc (nreverse cl-res) cl-seq1 cl-seq2) cl-type)))) | 678 | (coerce (nconc (nreverse cl-res) cl-seq1 cl-seq2) cl-type)))) |
| 648 | 679 | ||
| 649 | ;;; See compiler macro in cl-macs.el | 680 | ;;; See compiler macro in cl-macs.el |
| 681 | ;;;###autoload | ||
| 650 | (defun member* (cl-item cl-list &rest cl-keys) | 682 | (defun member* (cl-item cl-list &rest cl-keys) |
| 651 | "Find the first occurrence of ITEM in LIST. | 683 | "Find the first occurrence of ITEM in LIST. |
| 652 | Return the sublist of LIST whose car is ITEM. | 684 | Return the sublist of LIST whose car is ITEM. |
| @@ -661,6 +693,7 @@ Return the sublist of LIST whose car is ITEM. | |||
| 661 | (member cl-item cl-list) | 693 | (member cl-item cl-list) |
| 662 | (memq cl-item cl-list)))) | 694 | (memq cl-item cl-list)))) |
| 663 | 695 | ||
| 696 | ;;;###autoload | ||
| 664 | (defun member-if (cl-pred cl-list &rest cl-keys) | 697 | (defun member-if (cl-pred cl-list &rest cl-keys) |
| 665 | "Find the first item satisfying PREDICATE in LIST. | 698 | "Find the first item satisfying PREDICATE in LIST. |
| 666 | Return the sublist of LIST whose car matches. | 699 | Return the sublist of LIST whose car matches. |
| @@ -668,6 +701,7 @@ Return the sublist of LIST whose car matches. | |||
| 668 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" | 701 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" |
| 669 | (apply 'member* nil cl-list :if cl-pred cl-keys)) | 702 | (apply 'member* nil cl-list :if cl-pred cl-keys)) |
| 670 | 703 | ||
| 704 | ;;;###autoload | ||
| 671 | (defun member-if-not (cl-pred cl-list &rest cl-keys) | 705 | (defun member-if-not (cl-pred cl-list &rest cl-keys) |
| 672 | "Find the first item not satisfying PREDICATE in LIST. | 706 | "Find the first item not satisfying PREDICATE in LIST. |
| 673 | Return the sublist of LIST whose car matches. | 707 | Return the sublist of LIST whose car matches. |
| @@ -675,6 +709,7 @@ Return the sublist of LIST whose car matches. | |||
| 675 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" | 709 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" |
| 676 | (apply 'member* nil cl-list :if-not cl-pred cl-keys)) | 710 | (apply 'member* nil cl-list :if-not cl-pred cl-keys)) |
| 677 | 711 | ||
| 712 | ;;;###autoload | ||
| 678 | (defun cl-adjoin (cl-item cl-list &rest cl-keys) | 713 | (defun cl-adjoin (cl-item cl-list &rest cl-keys) |
| 679 | (if (cl-parsing-keywords (:key) t | 714 | (if (cl-parsing-keywords (:key) t |
| 680 | (apply 'member* (cl-check-key cl-item) cl-list cl-keys)) | 715 | (apply 'member* (cl-check-key cl-item) cl-list cl-keys)) |
| @@ -682,6 +717,7 @@ Return the sublist of LIST whose car matches. | |||
| 682 | (cons cl-item cl-list))) | 717 | (cons cl-item cl-list))) |
| 683 | 718 | ||
| 684 | ;;; See compiler macro in cl-macs.el | 719 | ;;; See compiler macro in cl-macs.el |
| 720 | ;;;###autoload | ||
| 685 | (defun assoc* (cl-item cl-alist &rest cl-keys) | 721 | (defun assoc* (cl-item cl-alist &rest cl-keys) |
| 686 | "Find the first item whose car matches ITEM in LIST. | 722 | "Find the first item whose car matches ITEM in LIST. |
| 687 | \nKeywords supported: :test :test-not :key | 723 | \nKeywords supported: :test :test-not :key |
| @@ -697,18 +733,21 @@ Return the sublist of LIST whose car matches. | |||
| 697 | (assoc cl-item cl-alist) | 733 | (assoc cl-item cl-alist) |
| 698 | (assq cl-item cl-alist)))) | 734 | (assq cl-item cl-alist)))) |
| 699 | 735 | ||
| 736 | ;;;###autoload | ||
| 700 | (defun assoc-if (cl-pred cl-list &rest cl-keys) | 737 | (defun assoc-if (cl-pred cl-list &rest cl-keys) |
| 701 | "Find the first item whose car satisfies PREDICATE in LIST. | 738 | "Find the first item whose car satisfies PREDICATE in LIST. |
| 702 | \nKeywords supported: :key | 739 | \nKeywords supported: :key |
| 703 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" | 740 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" |
| 704 | (apply 'assoc* nil cl-list :if cl-pred cl-keys)) | 741 | (apply 'assoc* nil cl-list :if cl-pred cl-keys)) |
| 705 | 742 | ||
| 743 | ;;;###autoload | ||
| 706 | (defun assoc-if-not (cl-pred cl-list &rest cl-keys) | 744 | (defun assoc-if-not (cl-pred cl-list &rest cl-keys) |
| 707 | "Find the first item whose car does not satisfy PREDICATE in LIST. | 745 | "Find the first item whose car does not satisfy PREDICATE in LIST. |
| 708 | \nKeywords supported: :key | 746 | \nKeywords supported: :key |
| 709 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" | 747 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" |
| 710 | (apply 'assoc* nil cl-list :if-not cl-pred cl-keys)) | 748 | (apply 'assoc* nil cl-list :if-not cl-pred cl-keys)) |
| 711 | 749 | ||
| 750 | ;;;###autoload | ||
| 712 | (defun rassoc* (cl-item cl-alist &rest cl-keys) | 751 | (defun rassoc* (cl-item cl-alist &rest cl-keys) |
| 713 | "Find the first item whose cdr matches ITEM in LIST. | 752 | "Find the first item whose cdr matches ITEM in LIST. |
| 714 | \nKeywords supported: :test :test-not :key | 753 | \nKeywords supported: :test :test-not :key |
| @@ -722,18 +761,21 @@ Return the sublist of LIST whose car matches. | |||
| 722 | (and cl-alist (car cl-alist))) | 761 | (and cl-alist (car cl-alist))) |
| 723 | (rassq cl-item cl-alist))) | 762 | (rassq cl-item cl-alist))) |
| 724 | 763 | ||
| 764 | ;;;###autoload | ||
| 725 | (defun rassoc-if (cl-pred cl-list &rest cl-keys) | 765 | (defun rassoc-if (cl-pred cl-list &rest cl-keys) |
| 726 | "Find the first item whose cdr satisfies PREDICATE in LIST. | 766 | "Find the first item whose cdr satisfies PREDICATE in LIST. |
| 727 | \nKeywords supported: :key | 767 | \nKeywords supported: :key |
| 728 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" | 768 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" |
| 729 | (apply 'rassoc* nil cl-list :if cl-pred cl-keys)) | 769 | (apply 'rassoc* nil cl-list :if cl-pred cl-keys)) |
| 730 | 770 | ||
| 771 | ;;;###autoload | ||
| 731 | (defun rassoc-if-not (cl-pred cl-list &rest cl-keys) | 772 | (defun rassoc-if-not (cl-pred cl-list &rest cl-keys) |
| 732 | "Find the first item whose cdr does not satisfy PREDICATE in LIST. | 773 | "Find the first item whose cdr does not satisfy PREDICATE in LIST. |
| 733 | \nKeywords supported: :key | 774 | \nKeywords supported: :key |
| 734 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" | 775 | \n(fn PREDICATE LIST [KEYWORD VALUE]...)" |
| 735 | (apply 'rassoc* nil cl-list :if-not cl-pred cl-keys)) | 776 | (apply 'rassoc* nil cl-list :if-not cl-pred cl-keys)) |
| 736 | 777 | ||
| 778 | ;;;###autoload | ||
| 737 | (defun union (cl-list1 cl-list2 &rest cl-keys) | 779 | (defun union (cl-list1 cl-list2 &rest cl-keys) |
| 738 | "Combine LIST1 and LIST2 using a set-union operation. | 780 | "Combine LIST1 and LIST2 using a set-union operation. |
| 739 | The result list contains all items that appear in either LIST1 or LIST2. | 781 | The result list contains all items that appear in either LIST1 or LIST2. |
| @@ -754,6 +796,7 @@ to avoid corrupting the original LIST1 and LIST2. | |||
| 754 | (pop cl-list2)) | 796 | (pop cl-list2)) |
| 755 | cl-list1))) | 797 | cl-list1))) |
| 756 | 798 | ||
| 799 | ;;;###autoload | ||
| 757 | (defun nunion (cl-list1 cl-list2 &rest cl-keys) | 800 | (defun nunion (cl-list1 cl-list2 &rest cl-keys) |
| 758 | "Combine LIST1 and LIST2 using a set-union operation. | 801 | "Combine LIST1 and LIST2 using a set-union operation. |
| 759 | The result list contains all items that appear in either LIST1 or LIST2. | 802 | The result list contains all items that appear in either LIST1 or LIST2. |
| @@ -764,6 +807,7 @@ whenever possible. | |||
| 764 | (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) | 807 | (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) |
| 765 | (t (apply 'union cl-list1 cl-list2 cl-keys)))) | 808 | (t (apply 'union cl-list1 cl-list2 cl-keys)))) |
| 766 | 809 | ||
| 810 | ;;;###autoload | ||
| 767 | (defun intersection (cl-list1 cl-list2 &rest cl-keys) | 811 | (defun intersection (cl-list1 cl-list2 &rest cl-keys) |
| 768 | "Combine LIST1 and LIST2 using a set-intersection operation. | 812 | "Combine LIST1 and LIST2 using a set-intersection operation. |
| 769 | The result list contains all items that appear in both LIST1 and LIST2. | 813 | The result list contains all items that appear in both LIST1 and LIST2. |
| @@ -786,6 +830,7 @@ to avoid corrupting the original LIST1 and LIST2. | |||
| 786 | (pop cl-list2)) | 830 | (pop cl-list2)) |
| 787 | cl-res))))) | 831 | cl-res))))) |
| 788 | 832 | ||
| 833 | ;;;###autoload | ||
| 789 | (defun nintersection (cl-list1 cl-list2 &rest cl-keys) | 834 | (defun nintersection (cl-list1 cl-list2 &rest cl-keys) |
| 790 | "Combine LIST1 and LIST2 using a set-intersection operation. | 835 | "Combine LIST1 and LIST2 using a set-intersection operation. |
| 791 | The result list contains all items that appear in both LIST1 and LIST2. | 836 | The result list contains all items that appear in both LIST1 and LIST2. |
| @@ -795,6 +840,7 @@ whenever possible. | |||
| 795 | \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" | 840 | \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" |
| 796 | (and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys))) | 841 | (and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys))) |
| 797 | 842 | ||
| 843 | ;;;###autoload | ||
| 798 | (defun set-difference (cl-list1 cl-list2 &rest cl-keys) | 844 | (defun set-difference (cl-list1 cl-list2 &rest cl-keys) |
| 799 | "Combine LIST1 and LIST2 using a set-difference operation. | 845 | "Combine LIST1 and LIST2 using a set-difference operation. |
| 800 | The result list contains all items that appear in LIST1 but not LIST2. | 846 | The result list contains all items that appear in LIST1 but not LIST2. |
| @@ -814,6 +860,7 @@ to avoid corrupting the original LIST1 and LIST2. | |||
| 814 | (pop cl-list1)) | 860 | (pop cl-list1)) |
| 815 | cl-res)))) | 861 | cl-res)))) |
| 816 | 862 | ||
| 863 | ;;;###autoload | ||
| 817 | (defun nset-difference (cl-list1 cl-list2 &rest cl-keys) | 864 | (defun nset-difference (cl-list1 cl-list2 &rest cl-keys) |
| 818 | "Combine LIST1 and LIST2 using a set-difference operation. | 865 | "Combine LIST1 and LIST2 using a set-difference operation. |
| 819 | The result list contains all items that appear in LIST1 but not LIST2. | 866 | The result list contains all items that appear in LIST1 but not LIST2. |
| @@ -824,6 +871,7 @@ whenever possible. | |||
| 824 | (if (or (null cl-list1) (null cl-list2)) cl-list1 | 871 | (if (or (null cl-list1) (null cl-list2)) cl-list1 |
| 825 | (apply 'set-difference cl-list1 cl-list2 cl-keys))) | 872 | (apply 'set-difference cl-list1 cl-list2 cl-keys))) |
| 826 | 873 | ||
| 874 | ;;;###autoload | ||
| 827 | (defun set-exclusive-or (cl-list1 cl-list2 &rest cl-keys) | 875 | (defun set-exclusive-or (cl-list1 cl-list2 &rest cl-keys) |
| 828 | "Combine LIST1 and LIST2 using a set-exclusive-or operation. | 876 | "Combine LIST1 and LIST2 using a set-exclusive-or operation. |
| 829 | The result list contains all items that appear in exactly one of LIST1, LIST2. | 877 | The result list contains all items that appear in exactly one of LIST1, LIST2. |
| @@ -836,6 +884,7 @@ to avoid corrupting the original LIST1 and LIST2. | |||
| 836 | (t (append (apply 'set-difference cl-list1 cl-list2 cl-keys) | 884 | (t (append (apply 'set-difference cl-list1 cl-list2 cl-keys) |
| 837 | (apply 'set-difference cl-list2 cl-list1 cl-keys))))) | 885 | (apply 'set-difference cl-list2 cl-list1 cl-keys))))) |
| 838 | 886 | ||
| 887 | ;;;###autoload | ||
| 839 | (defun nset-exclusive-or (cl-list1 cl-list2 &rest cl-keys) | 888 | (defun nset-exclusive-or (cl-list1 cl-list2 &rest cl-keys) |
| 840 | "Combine LIST1 and LIST2 using a set-exclusive-or operation. | 889 | "Combine LIST1 and LIST2 using a set-exclusive-or operation. |
| 841 | The result list contains all items that appear in exactly one of LIST1, LIST2. | 890 | The result list contains all items that appear in exactly one of LIST1, LIST2. |
| @@ -848,6 +897,7 @@ whenever possible. | |||
| 848 | (t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys) | 897 | (t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys) |
| 849 | (apply 'nset-difference cl-list2 cl-list1 cl-keys))))) | 898 | (apply 'nset-difference cl-list2 cl-list1 cl-keys))))) |
| 850 | 899 | ||
| 900 | ;;;###autoload | ||
| 851 | (defun subsetp (cl-list1 cl-list2 &rest cl-keys) | 901 | (defun subsetp (cl-list1 cl-list2 &rest cl-keys) |
| 852 | "Return true if LIST1 is a subset of LIST2. | 902 | "Return true if LIST1 is a subset of LIST2. |
| 853 | I.e., if every element of LIST1 also appears in LIST2. | 903 | I.e., if every element of LIST1 also appears in LIST2. |
| @@ -862,6 +912,7 @@ I.e., if every element of LIST1 also appears in LIST2. | |||
| 862 | (pop cl-list1)) | 912 | (pop cl-list1)) |
| 863 | (null cl-list1))))) | 913 | (null cl-list1))))) |
| 864 | 914 | ||
| 915 | ;;;###autoload | ||
| 865 | (defun subst-if (cl-new cl-pred cl-tree &rest cl-keys) | 916 | (defun subst-if (cl-new cl-pred cl-tree &rest cl-keys) |
| 866 | "Substitute NEW for elements matching PREDICATE in TREE (non-destructively). | 917 | "Substitute NEW for elements matching PREDICATE in TREE (non-destructively). |
| 867 | Return a copy of TREE with all matching elements replaced by NEW. | 918 | Return a copy of TREE with all matching elements replaced by NEW. |
| @@ -869,6 +920,7 @@ Return a copy of TREE with all matching elements replaced by NEW. | |||
| 869 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" | 920 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" |
| 870 | (apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) | 921 | (apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) |
| 871 | 922 | ||
| 923 | ;;;###autoload | ||
| 872 | (defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys) | 924 | (defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys) |
| 873 | "Substitute NEW for elts not matching PREDICATE in TREE (non-destructively). | 925 | "Substitute NEW for elts not matching PREDICATE in TREE (non-destructively). |
| 874 | Return a copy of TREE with all non-matching elements replaced by NEW. | 926 | Return a copy of TREE with all non-matching elements replaced by NEW. |
| @@ -876,6 +928,7 @@ Return a copy of TREE with all non-matching elements replaced by NEW. | |||
| 876 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" | 928 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" |
| 877 | (apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) | 929 | (apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) |
| 878 | 930 | ||
| 931 | ;;;###autoload | ||
| 879 | (defun nsubst (cl-new cl-old cl-tree &rest cl-keys) | 932 | (defun nsubst (cl-new cl-old cl-tree &rest cl-keys) |
| 880 | "Substitute NEW for OLD everywhere in TREE (destructively). | 933 | "Substitute NEW for OLD everywhere in TREE (destructively). |
| 881 | Any element of TREE which is `eql' to OLD is changed to NEW (via a call | 934 | Any element of TREE which is `eql' to OLD is changed to NEW (via a call |
| @@ -884,6 +937,7 @@ to `setcar'). | |||
| 884 | \n(fn NEW OLD TREE [KEYWORD VALUE]...)" | 937 | \n(fn NEW OLD TREE [KEYWORD VALUE]...)" |
| 885 | (apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys)) | 938 | (apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys)) |
| 886 | 939 | ||
| 940 | ;;;###autoload | ||
| 887 | (defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys) | 941 | (defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys) |
| 888 | "Substitute NEW for elements matching PREDICATE in TREE (destructively). | 942 | "Substitute NEW for elements matching PREDICATE in TREE (destructively). |
| 889 | Any element of TREE which matches is changed to NEW (via a call to `setcar'). | 943 | Any element of TREE which matches is changed to NEW (via a call to `setcar'). |
| @@ -891,6 +945,7 @@ Any element of TREE which matches is changed to NEW (via a call to `setcar'). | |||
| 891 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" | 945 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" |
| 892 | (apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) | 946 | (apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) |
| 893 | 947 | ||
| 948 | ;;;###autoload | ||
| 894 | (defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys) | 949 | (defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys) |
| 895 | "Substitute NEW for elements not matching PREDICATE in TREE (destructively). | 950 | "Substitute NEW for elements not matching PREDICATE in TREE (destructively). |
| 896 | Any element of TREE which matches is changed to NEW (via a call to `setcar'). | 951 | Any element of TREE which matches is changed to NEW (via a call to `setcar'). |
| @@ -898,6 +953,7 @@ Any element of TREE which matches is changed to NEW (via a call to `setcar'). | |||
| 898 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" | 953 | \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" |
| 899 | (apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) | 954 | (apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) |
| 900 | 955 | ||
| 956 | ;;;###autoload | ||
| 901 | (defun sublis (cl-alist cl-tree &rest cl-keys) | 957 | (defun sublis (cl-alist cl-tree &rest cl-keys) |
| 902 | "Perform substitutions indicated by ALIST in TREE (non-destructively). | 958 | "Perform substitutions indicated by ALIST in TREE (non-destructively). |
| 903 | Return a copy of TREE with all matching elements replaced. | 959 | Return a copy of TREE with all matching elements replaced. |
| @@ -920,6 +976,7 @@ Return a copy of TREE with all matching elements replaced. | |||
| 920 | (cons cl-a cl-d))) | 976 | (cons cl-a cl-d))) |
| 921 | cl-tree)))) | 977 | cl-tree)))) |
| 922 | 978 | ||
| 979 | ;;;###autoload | ||
| 923 | (defun nsublis (cl-alist cl-tree &rest cl-keys) | 980 | (defun nsublis (cl-alist cl-tree &rest cl-keys) |
| 924 | "Perform substitutions indicated by ALIST in TREE (destructively). | 981 | "Perform substitutions indicated by ALIST in TREE (destructively). |
| 925 | Any matching element of TREE is changed via a call to `setcar'. | 982 | Any matching element of TREE is changed via a call to `setcar'. |
| @@ -944,6 +1001,7 @@ Any matching element of TREE is changed via a call to `setcar'. | |||
| 944 | (progn (setcdr cl-tree (cdr (car cl-p))) (setq cl-tree nil)) | 1001 | (progn (setcdr cl-tree (cdr (car cl-p))) (setq cl-tree nil)) |
| 945 | (setq cl-tree (cdr cl-tree)))))) | 1002 | (setq cl-tree (cdr cl-tree)))))) |
| 946 | 1003 | ||
| 1004 | ;;;###autoload | ||
| 947 | (defun tree-equal (cl-x cl-y &rest cl-keys) | 1005 | (defun tree-equal (cl-x cl-y &rest cl-keys) |
| 948 | "Return t if trees TREE1 and TREE2 have `eql' leaves. | 1006 | "Return t if trees TREE1 and TREE2 have `eql' leaves. |
| 949 | Atoms are compared by `eql'; cons cells are compared recursively. | 1007 | Atoms are compared by `eql'; cons cells are compared recursively. |
| @@ -961,5 +1019,9 @@ Atoms are compared by `eql'; cons cells are compared recursively. | |||
| 961 | 1019 | ||
| 962 | (run-hooks 'cl-seq-load-hook) | 1020 | (run-hooks 'cl-seq-load-hook) |
| 963 | 1021 | ||
| 964 | ;;; arch-tag: ec1cc072-9006-4225-b6ba-d6b07ed1710c | 1022 | ;; Local variables: |
| 1023 | ;; generated-autoload-file: "cl-loaddefs.el" | ||
| 1024 | ;; End: | ||
| 1025 | |||
| 1026 | ;; arch-tag: ec1cc072-9006-4225-b6ba-d6b07ed1710c | ||
| 965 | ;;; cl-seq.el ends here | 1027 | ;;; cl-seq.el ends here |