[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/cl-seq.el
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/cl-seq.el |
Date: |
Fri, 20 May 2005 10:29:47 -0400 |
Index: emacs/lisp/emacs-lisp/cl-seq.el
diff -c emacs/lisp/emacs-lisp/cl-seq.el:1.13
emacs/lisp/emacs-lisp/cl-seq.el:1.14
*** emacs/lisp/emacs-lisp/cl-seq.el:1.13 Tue May 17 00:27:32 2005
--- emacs/lisp/emacs-lisp/cl-seq.el Fri May 20 14:29:47 2005
***************
*** 125,132 ****
(defun reduce (cl-func cl-seq &rest cl-keys)
! "Reduce two-argument FUNCTION across SEQUENCE.
! Keywords supported: :start :end :from-end :initial-value :key"
(cl-parsing-keywords (:from-end (:start 0) :end :initial-value :key) ()
(or (listp cl-seq) (setq cl-seq (append cl-seq nil)))
(setq cl-seq (subseq cl-seq cl-start cl-end))
--- 125,133 ----
(defun reduce (cl-func cl-seq &rest cl-keys)
! "Reduce two-argument FUNCTION across SEQ.
! \nKeywords supported: :start :end :from-end :initial-value :key
! \n(fn FUNCTION SEQ [KEYWORD VALUE]...)"
(cl-parsing-keywords (:from-end (:start 0) :end :initial-value :key) ()
(or (listp cl-seq) (setq cl-seq (append cl-seq nil)))
(setq cl-seq (subseq cl-seq cl-start cl-end))
***************
*** 145,151 ****
(defun fill (seq item &rest cl-keys)
"Fill the elements of SEQ with ITEM.
! Keywords supported: :start :end"
(cl-parsing-keywords ((:start 0) :end) ()
(if (listp seq)
(let ((p (nthcdr cl-start seq))
--- 146,153 ----
(defun fill (seq item &rest cl-keys)
"Fill the elements of SEQ with ITEM.
! \nKeywords supported: :start :end
! \n(fn SEQ ITEM [KEYWORD VALUE]...)"
(cl-parsing-keywords ((:start 0) :end) ()
(if (listp seq)
(let ((p (nthcdr cl-start seq))
***************
*** 164,170 ****
(defun replace (cl-seq1 cl-seq2 &rest cl-keys)
"Replace the elements of SEQ1 with the elements of SEQ2.
SEQ1 is destructively modified, then returned.
! Keywords supported: :start1 :end1 :start2 :end2"
(cl-parsing-keywords ((:start1 0) :end1 (:start2 0) :end2) ()
(if (and (eq cl-seq1 cl-seq2) (<= cl-start2 cl-start1))
(or (= cl-start1 cl-start2)
--- 166,173 ----
(defun replace (cl-seq1 cl-seq2 &rest cl-keys)
"Replace the elements of SEQ1 with the elements of SEQ2.
SEQ1 is destructively modified, then returned.
! \nKeywords supported: :start1 :end1 :start2 :end2
! \n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
(cl-parsing-keywords ((:start1 0) :end1 (:start2 0) :end2) ()
(if (and (eq cl-seq1 cl-seq2) (<= cl-start2 cl-start1))
(or (= cl-start1 cl-start2)
***************
*** 206,212 ****
"Remove all occurrences of ITEM in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! Keywords supported: :test :test-not :key :count :start :end :from-end"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
(:start 0) :end) ()
(if (<= (or cl-count (setq cl-count 8000000)) 0)
--- 209,216 ----
"Remove all occurrences of ITEM in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! \nKeywords supported: :test :test-not :key :count :start :end :from-end
! \n(fn ITEM SEQ [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
(:start 0) :end) ()
(if (<= (or cl-count (setq cl-count 8000000)) 0)
***************
*** 250,269 ****
"Remove all items satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! Keywords supported: :key :count :start :end :from-end"
(apply 'remove* nil cl-list :if cl-pred cl-keys))
(defun remove-if-not (cl-pred cl-list &rest cl-keys)
"Remove all items not satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! Keywords supported: :key :count :start :end :from-end"
(apply 'remove* nil cl-list :if-not cl-pred cl-keys))
(defun delete* (cl-item cl-seq &rest cl-keys)
"Remove all occurrences of ITEM in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! Keywords supported: :test :test-not :key :count :start :end :from-end"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
(:start 0) :end) ()
(if (<= (or cl-count (setq cl-count 8000000)) 0)
--- 254,276 ----
"Remove all items satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'remove* nil cl-list :if cl-pred cl-keys))
(defun remove-if-not (cl-pred cl-list &rest cl-keys)
"Remove all items not satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'remove* nil cl-list :if-not cl-pred cl-keys))
(defun delete* (cl-item cl-seq &rest cl-keys)
"Remove all occurrences of ITEM in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! \nKeywords supported: :test :test-not :key :count :start :end :from-end
! \n(fn ITEM SEQ [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
(:start 0) :end) ()
(if (<= (or cl-count (setq cl-count 8000000)) 0)
***************
*** 305,327 ****
(defun delete-if (cl-pred cl-list &rest cl-keys)
"Remove all items satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! Keywords supported: :key :count :start :end :from-end"
(apply 'delete* nil cl-list :if cl-pred cl-keys))
(defun delete-if-not (cl-pred cl-list &rest cl-keys)
"Remove all items not satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! Keywords supported: :key :count :start :end :from-end"
(apply 'delete* nil cl-list :if-not cl-pred cl-keys))
(defun remove-duplicates (cl-seq &rest cl-keys)
"Return a copy of SEQ with all duplicate elements removed.
! Keywords supported: :test :test-not :key :start :end :from-end"
(cl-delete-duplicates cl-seq cl-keys t))
(defun delete-duplicates (cl-seq &rest cl-keys)
"Remove all duplicate elements from SEQ (destructively).
! Keywords supported: :test :test-not :key :start :end :from-end"
(cl-delete-duplicates cl-seq cl-keys nil))
(defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
--- 312,338 ----
(defun delete-if (cl-pred cl-list &rest cl-keys)
"Remove all items satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'delete* nil cl-list :if cl-pred cl-keys))
(defun delete-if-not (cl-pred cl-list &rest cl-keys)
"Remove all items not satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'delete* nil cl-list :if-not cl-pred cl-keys))
(defun remove-duplicates (cl-seq &rest cl-keys)
"Return a copy of SEQ with all duplicate elements removed.
! \nKeywords supported: :test :test-not :key :start :end :from-end
! \n(fn SEQ [KEYWORD VALUE]...)"
(cl-delete-duplicates cl-seq cl-keys t))
(defun delete-duplicates (cl-seq &rest cl-keys)
"Remove all duplicate elements from SEQ (destructively).
! \nKeywords supported: :test :test-not :key :start :end :from-end
! \n(fn SEQ [KEYWORD VALUE]...)"
(cl-delete-duplicates cl-seq cl-keys nil))
(defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
***************
*** 368,374 ****
"Substitute NEW for OLD in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! Keywords supported: :test :test-not :key :count :start :end :from-end"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count
(:start 0) :end :from-end) ()
(if (or (eq cl-old cl-new)
--- 379,386 ----
"Substitute NEW for OLD in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! \nKeywords supported: :test :test-not :key :count :start :end :from-end
! \n(fn NEW OLD SEQ [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count
(:start 0) :end :from-end) ()
(if (or (eq cl-old cl-new)
***************
*** 388,407 ****
"Substitute NEW for all items satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! Keywords supported: :key :count :start :end :from-end"
(apply 'substitute cl-new nil cl-list :if cl-pred cl-keys))
(defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items not satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! Keywords supported: :key :count :start :end :from-end"
(apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys))
(defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys)
"Substitute NEW for OLD in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! Keywords supported: :test :test-not :key :count :start :end :from-end"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count
(:start 0) :end :from-end) ()
(or (eq cl-old cl-new) (<= (or cl-count (setq cl-count 8000000)) 0)
--- 400,422 ----
"Substitute NEW for all items satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'substitute cl-new nil cl-list :if cl-pred cl-keys))
(defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items not satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
to avoid corrupting the original SEQ.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys))
(defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys)
"Substitute NEW for OLD in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! \nKeywords supported: :test :test-not :key :count :start :end :from-end
! \n(fn NEW OLD SEQ [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not :count
(:start 0) :end :from-end) ()
(or (eq cl-old cl-new) (<= (or cl-count (setq cl-count 8000000)) 0)
***************
*** 433,470 ****
(defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! Keywords supported: :key :count :start :end :from-end"
(apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys))
(defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items not satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! Keywords supported: :key :count :start :end :from-end"
(apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys))
(defun find (cl-item cl-seq &rest cl-keys)
! "Find the first occurrence of ITEM in LIST.
Return the matching ITEM, or nil if not found.
! Keywords supported: :test :test-not :key :start :end :from-end"
(let ((cl-pos (apply 'position cl-item cl-seq cl-keys)))
(and cl-pos (elt cl-seq cl-pos))))
(defun find-if (cl-pred cl-list &rest cl-keys)
! "Find the first item satisfying PREDICATE in LIST.
! Return the matching ITEM, or nil if not found.
! Keywords supported: :key :start :end :from-end"
(apply 'find nil cl-list :if cl-pred cl-keys))
(defun find-if-not (cl-pred cl-list &rest cl-keys)
! "Find the first item not satisfying PREDICATE in LIST.
! Return the matching ITEM, or nil if not found.
! Keywords supported: :key :start :end :from-end"
(apply 'find nil cl-list :if-not cl-pred cl-keys))
(defun position (cl-item cl-seq &rest cl-keys)
! "Find the first occurrence of ITEM in LIST.
Return the index of the matching item, or nil if not found.
! Keywords supported: :test :test-not :key :start :end :from-end"
(cl-parsing-keywords (:test :test-not :key :if :if-not
(:start 0) :end :from-end) ()
(cl-position cl-item cl-seq cl-start cl-end cl-from-end)))
--- 448,491 ----
(defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys))
(defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items not satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever
possible.
! \nKeywords supported: :key :count :start :end :from-end
! \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys))
(defun find (cl-item cl-seq &rest cl-keys)
! "Find the first occurrence of ITEM in SEQ.
Return the matching ITEM, or nil if not found.
! \nKeywords supported: :test :test-not :key :start :end :from-end
! \n(fn ITEM SEQ [KEYWORD VALUE]...)"
(let ((cl-pos (apply 'position cl-item cl-seq cl-keys)))
(and cl-pos (elt cl-seq cl-pos))))
(defun find-if (cl-pred cl-list &rest cl-keys)
! "Find the first item satisfying PREDICATE in SEQ.
! Return the matching item, or nil if not found.
! \nKeywords supported: :key :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'find nil cl-list :if cl-pred cl-keys))
(defun find-if-not (cl-pred cl-list &rest cl-keys)
! "Find the first item not satisfying PREDICATE in SEQ.
! Return the matching item, or nil if not found.
! \nKeywords supported: :key :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'find nil cl-list :if-not cl-pred cl-keys))
(defun position (cl-item cl-seq &rest cl-keys)
! "Find the first occurrence of ITEM in SEQ.
Return the index of the matching item, or nil if not found.
! \nKeywords supported: :test :test-not :key :start :end :from-end
! \n(fn ITEM SEQ [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not
(:start 0) :end :from-end) ()
(cl-position cl-item cl-seq cl-start cl-end cl-from-end)))
***************
*** 491,510 ****
(and (< cl-start cl-end) cl-start))))
(defun position-if (cl-pred cl-list &rest cl-keys)
! "Find the first item satisfying PREDICATE in LIST.
Return the index of the matching item, or nil if not found.
! Keywords supported: :key :start :end :from-end"
(apply 'position nil cl-list :if cl-pred cl-keys))
(defun position-if-not (cl-pred cl-list &rest cl-keys)
! "Find the first item not satisfying PREDICATE in LIST.
Return the index of the matching item, or nil if not found.
! Keywords supported: :key :start :end :from-end"
(apply 'position nil cl-list :if-not cl-pred cl-keys))
(defun count (cl-item cl-seq &rest cl-keys)
! "Count the number of occurrences of ITEM in LIST.
! Keywords supported: :test :test-not :key :start :end"
(cl-parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) ()
(let ((cl-count 0) cl-x)
(or cl-end (setq cl-end (length cl-seq)))
--- 512,534 ----
(and (< cl-start cl-end) cl-start))))
(defun position-if (cl-pred cl-list &rest cl-keys)
! "Find the first item satisfying PREDICATE in SEQ.
Return the index of the matching item, or nil if not found.
! \nKeywords supported: :key :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'position nil cl-list :if cl-pred cl-keys))
(defun position-if-not (cl-pred cl-list &rest cl-keys)
! "Find the first item not satisfying PREDICATE in SEQ.
Return the index of the matching item, or nil if not found.
! \nKeywords supported: :key :start :end :from-end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'position nil cl-list :if-not cl-pred cl-keys))
(defun count (cl-item cl-seq &rest cl-keys)
! "Count the number of occurrences of ITEM in SEQ.
! \nKeywords supported: :test :test-not :key :start :end
! \n(fn ITEM SEQ [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) ()
(let ((cl-count 0) cl-x)
(or cl-end (setq cl-end (length cl-seq)))
***************
*** 516,535 ****
cl-count)))
(defun count-if (cl-pred cl-list &rest cl-keys)
! "Count the number of items satisfying PREDICATE in LIST.
! Keywords supported: :key :start :end"
(apply 'count nil cl-list :if cl-pred cl-keys))
(defun count-if-not (cl-pred cl-list &rest cl-keys)
! "Count the number of items not satisfying PREDICATE in LIST.
! Keywords supported: :key :start :end"
(apply 'count nil cl-list :if-not cl-pred cl-keys))
(defun mismatch (cl-seq1 cl-seq2 &rest cl-keys)
"Compare SEQ1 with SEQ2, return index of first mismatching element.
Return nil if the sequences match. If one sequence is a prefix of the
other, the return value indicates the end of the shorter sequence.
! Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2
:from-end"
(cl-parsing-keywords (:test :test-not :key :from-end
(:start1 0) :end1 (:start2 0) :end2) ()
(or cl-end1 (setq cl-end1 (length cl-seq1)))
--- 540,562 ----
cl-count)))
(defun count-if (cl-pred cl-list &rest cl-keys)
! "Count the number of items satisfying PREDICATE in SEQ.
! \nKeywords supported: :key :start :end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'count nil cl-list :if cl-pred cl-keys))
(defun count-if-not (cl-pred cl-list &rest cl-keys)
! "Count the number of items not satisfying PREDICATE in SEQ.
! \nKeywords supported: :key :start :end
! \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'count nil cl-list :if-not cl-pred cl-keys))
(defun mismatch (cl-seq1 cl-seq2 &rest cl-keys)
"Compare SEQ1 with SEQ2, return index of first mismatching element.
Return nil if the sequences match. If one sequence is a prefix of the
other, the return value indicates the end of the shorter sequence.
! \nKeywords supported: :test :test-not :key :start1 :end1 :start2 :end2
:from-end
! \n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :from-end
(:start1 0) :end1 (:start2 0) :end2) ()
(or cl-end1 (setq cl-end1 (length cl-seq1)))
***************
*** 558,564 ****
"Search for SEQ1 as a subsequence of SEQ2.
Return the index of the leftmost element of the first match found;
return nil if there are no matches.
! Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2
:from-end"
(cl-parsing-keywords (:test :test-not :key :from-end
(:start1 0) :end1 (:start2 0) :end2) ()
(or cl-end1 (setq cl-end1 (length cl-seq1)))
--- 585,592 ----
"Search for SEQ1 as a subsequence of SEQ2.
Return the index of the leftmost element of the first match found;
return nil if there are no matches.
! \nKeywords supported: :test :test-not :key :start1 :end1 :start2 :end2
:from-end
! \n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :from-end
(:start1 0) :end1 (:start2 0) :end2) ()
(or cl-end1 (setq cl-end1 (length cl-seq1)))
***************
*** 580,588 ****
(and (< cl-start2 cl-end2) cl-pos)))))
(defun sort* (cl-seq cl-pred &rest cl-keys)
! "Sort the argument SEQUENCE according to PREDICATE.
! This is a destructive function; it reuses the storage of SEQUENCE if possible.
! Keywords supported: :key"
(if (nlistp cl-seq)
(replace cl-seq (apply 'sort* (append cl-seq nil) cl-pred cl-keys))
(cl-parsing-keywords (:key) ()
--- 608,617 ----
(and (< cl-start2 cl-end2) cl-pos)))))
(defun sort* (cl-seq cl-pred &rest cl-keys)
! "Sort the argument SEQ according to PREDICATE.
! This is a destructive function; it reuses the storage of SEQ if possible.
! \nKeywords supported: :key
! \n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
(if (nlistp cl-seq)
(replace cl-seq (apply 'sort* (append cl-seq nil) cl-pred cl-keys))
(cl-parsing-keywords (:key) ()
***************
*** 593,608 ****
(funcall cl-key cl-y)))))))))
(defun stable-sort (cl-seq cl-pred &rest cl-keys)
! "Sort the argument SEQUENCE stably according to PREDICATE.
! This is a destructive function; it reuses the storage of SEQUENCE if possible.
! Keywords supported: :key"
(apply 'sort* cl-seq cl-pred cl-keys))
(defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys)
"Destructively merge the two sequences to produce a new sequence.
! TYPE is the sequence type to return, SEQ1 and SEQ2 are the two
! argument sequences, and PRED is a `less-than' predicate on the elements.
! Keywords supported: :key"
(or (listp cl-seq1) (setq cl-seq1 (append cl-seq1 nil)))
(or (listp cl-seq2) (setq cl-seq2 (append cl-seq2 nil)))
(cl-parsing-keywords (:key) ()
--- 622,639 ----
(funcall cl-key cl-y)))))))))
(defun stable-sort (cl-seq cl-pred &rest cl-keys)
! "Sort the argument SEQ stably according to PREDICATE.
! This is a destructive function; it reuses the storage of SEQ if possible.
! \nKeywords supported: :key
! \n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
(apply 'sort* cl-seq cl-pred cl-keys))
(defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys)
"Destructively merge the two sequences to produce a new sequence.
! TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument
! sequences, and PREDICATE is a `less-than' predicate on the elements.
! \nKeywords supported: :key
! \n(fn TYPE SEQ1 SEQ2 PREDICATE [KEYWORD VALUE]...)"
(or (listp cl-seq1) (setq cl-seq1 (append cl-seq1 nil)))
(or (listp cl-seq2) (setq cl-seq2 (append cl-seq2 nil)))
(cl-parsing-keywords (:key) ()
***************
*** 618,624 ****
(defun member* (cl-item cl-list &rest cl-keys)
"Find the first occurrence of ITEM in LIST.
Return the sublist of LIST whose car is ITEM.
! Keywords supported: :test :test-not :key"
(if cl-keys
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(while (and cl-list (not (cl-check-test cl-item (car cl-list))))
--- 649,656 ----
(defun member* (cl-item cl-list &rest cl-keys)
"Find the first occurrence of ITEM in LIST.
Return the sublist of LIST whose car is ITEM.
! \nKeywords supported: :test :test-not :key
! \n(fn ITEM LIST [KEYWORD VALUE]...)"
(if cl-keys
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(while (and cl-list (not (cl-check-test cl-item (car cl-list))))
***************
*** 631,643 ****
(defun member-if (cl-pred cl-list &rest cl-keys)
"Find the first item satisfying PREDICATE in LIST.
Return the sublist of LIST whose car matches.
! Keywords supported: :key"
(apply 'member* nil cl-list :if cl-pred cl-keys))
(defun member-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item not satisfying PREDICATE in LIST.
Return the sublist of LIST whose car matches.
! Keywords supported: :key"
(apply 'member* nil cl-list :if-not cl-pred cl-keys))
(defun cl-adjoin (cl-item cl-list &rest cl-keys)
--- 663,677 ----
(defun member-if (cl-pred cl-list &rest cl-keys)
"Find the first item satisfying PREDICATE in LIST.
Return the sublist of LIST whose car matches.
! \nKeywords supported: :key
! \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'member* nil cl-list :if cl-pred cl-keys))
(defun member-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item not satisfying PREDICATE in LIST.
Return the sublist of LIST whose car matches.
! \nKeywords supported: :key
! \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'member* nil cl-list :if-not cl-pred cl-keys))
(defun cl-adjoin (cl-item cl-list &rest cl-keys)
***************
*** 649,655 ****
;;; See compiler macro in cl-macs.el
(defun assoc* (cl-item cl-alist &rest cl-keys)
"Find the first item whose car matches ITEM in LIST.
! Keywords supported: :test :test-not :key"
(if cl-keys
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(while (and cl-alist
--- 683,690 ----
;;; See compiler macro in cl-macs.el
(defun assoc* (cl-item cl-alist &rest cl-keys)
"Find the first item whose car matches ITEM in LIST.
! \nKeywords supported: :test :test-not :key
! \n(fn ITEM LIST [KEYWORD VALUE]...)"
(if cl-keys
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(while (and cl-alist
***************
*** 663,679 ****
(defun assoc-if (cl-pred cl-list &rest cl-keys)
"Find the first item whose car satisfies PREDICATE in LIST.
! Keywords supported: :key"
(apply 'assoc* nil cl-list :if cl-pred cl-keys))
(defun assoc-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item whose car does not satisfy PREDICATE in LIST.
! Keywords supported: :key"
(apply 'assoc* nil cl-list :if-not cl-pred cl-keys))
(defun rassoc* (cl-item cl-alist &rest cl-keys)
"Find the first item whose cdr matches ITEM in LIST.
! Keywords supported: :test :test-not :key"
(if (or cl-keys (numberp cl-item))
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(while (and cl-alist
--- 698,717 ----
(defun assoc-if (cl-pred cl-list &rest cl-keys)
"Find the first item whose car satisfies PREDICATE in LIST.
! \nKeywords supported: :key
! \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'assoc* nil cl-list :if cl-pred cl-keys))
(defun assoc-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item whose car does not satisfy PREDICATE in LIST.
! \nKeywords supported: :key
! \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'assoc* nil cl-list :if-not cl-pred cl-keys))
(defun rassoc* (cl-item cl-alist &rest cl-keys)
"Find the first item whose cdr matches ITEM in LIST.
! \nKeywords supported: :test :test-not :key
! \n(fn ITEM LIST [KEYWORD VALUE]...)"
(if (or cl-keys (numberp cl-item))
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(while (and cl-alist
***************
*** 685,696 ****
(defun rassoc-if (cl-pred cl-list &rest cl-keys)
"Find the first item whose cdr satisfies PREDICATE in LIST.
! Keywords supported: :key"
(apply 'rassoc* nil cl-list :if cl-pred cl-keys))
(defun rassoc-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item whose cdr does not satisfy PREDICATE in LIST.
! Keywords supported: :key"
(apply 'rassoc* nil cl-list :if-not cl-pred cl-keys))
(defun union (cl-list1 cl-list2 &rest cl-keys)
--- 723,736 ----
(defun rassoc-if (cl-pred cl-list &rest cl-keys)
"Find the first item whose cdr satisfies PREDICATE in LIST.
! \nKeywords supported: :key
! \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'rassoc* nil cl-list :if cl-pred cl-keys))
(defun rassoc-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item whose cdr does not satisfy PREDICATE in LIST.
! \nKeywords supported: :key
! \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'rassoc* nil cl-list :if-not cl-pred cl-keys))
(defun union (cl-list1 cl-list2 &rest cl-keys)
***************
*** 698,704 ****
The result list contains all items that appear in either LIST1 or LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! Keywords supported: :test :test-not :key"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
((equal cl-list1 cl-list2) cl-list1)
(t
--- 738,745 ----
The result list contains all items that appear in either LIST1 or LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
((equal cl-list1 cl-list2) cl-list1)
(t
***************
*** 717,723 ****
The result list contains all items that appear in either LIST1 or LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! Keywords supported: :test :test-not :key"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
(t (apply 'union cl-list1 cl-list2 cl-keys))))
--- 758,765 ----
The result list contains all items that appear in either LIST1 or LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
(t (apply 'union cl-list1 cl-list2 cl-keys))))
***************
*** 726,732 ****
The result list contains all items that appear in both LIST1 and LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! Keywords supported: :test :test-not :key"
(and cl-list1 cl-list2
(if (equal cl-list1 cl-list2) cl-list1
(cl-parsing-keywords (:key) (:test :test-not)
--- 768,775 ----
The result list contains all items that appear in both LIST1 and LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(and cl-list1 cl-list2
(if (equal cl-list1 cl-list2) cl-list1
(cl-parsing-keywords (:key) (:test :test-not)
***************
*** 747,753 ****
The result list contains all items that appear in both LIST1 and LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! Keywords supported: :test :test-not :key"
(and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys)))
(defun set-difference (cl-list1 cl-list2 &rest cl-keys)
--- 790,797 ----
The result list contains all items that appear in both LIST1 and LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys)))
(defun set-difference (cl-list1 cl-list2 &rest cl-keys)
***************
*** 755,761 ****
The result list contains all items that appear in LIST1 but not LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! Keywords supported: :test :test-not :key"
(if (or (null cl-list1) (null cl-list2)) cl-list1
(cl-parsing-keywords (:key) (:test :test-not)
(let ((cl-res nil))
--- 799,806 ----
The result list contains all items that appear in LIST1 but not LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(if (or (null cl-list1) (null cl-list2)) cl-list1
(cl-parsing-keywords (:key) (:test :test-not)
(let ((cl-res nil))
***************
*** 773,779 ****
The result list contains all items that appear in LIST1 but not LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! Keywords supported: :test :test-not :key"
(if (or (null cl-list1) (null cl-list2)) cl-list1
(apply 'set-difference cl-list1 cl-list2 cl-keys)))
--- 818,825 ----
The result list contains all items that appear in LIST1 but not LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(if (or (null cl-list1) (null cl-list2)) cl-list1
(apply 'set-difference cl-list1 cl-list2 cl-keys)))
***************
*** 782,788 ****
The result list contains all items that appear in exactly one of LIST1, LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! Keywords supported: :test :test-not :key"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
((equal cl-list1 cl-list2) nil)
(t (append (apply 'set-difference cl-list1 cl-list2 cl-keys)
--- 828,835 ----
The result list contains all items that appear in exactly one of LIST1, LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
((equal cl-list1 cl-list2) nil)
(t (append (apply 'set-difference cl-list1 cl-list2 cl-keys)
***************
*** 793,799 ****
The result list contains all items that appear in exactly one of LIST1, LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! Keywords supported: :test :test-not :key"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
((equal cl-list1 cl-list2) nil)
(t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys)
--- 840,847 ----
The result list contains all items that appear in exactly one of LIST1, LIST2.
This is a destructive function; it reuses the storage of LIST1 and LIST2
whenever possible.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
((equal cl-list1 cl-list2) nil)
(t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys)
***************
*** 802,808 ****
(defun subsetp (cl-list1 cl-list2 &rest cl-keys)
"Return true if LIST1 is a subset of LIST2.
I.e., if every element of LIST1 also appears in LIST2.
! Keywords supported: :test :test-not :key"
(cond ((null cl-list1) t) ((null cl-list2) nil)
((equal cl-list1 cl-list2) t)
(t (cl-parsing-keywords (:key) (:test :test-not)
--- 850,857 ----
(defun subsetp (cl-list1 cl-list2 &rest cl-keys)
"Return true if LIST1 is a subset of LIST2.
I.e., if every element of LIST1 also appears in LIST2.
! \nKeywords supported: :test :test-not :key
! \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(cond ((null cl-list1) t) ((null cl-list2) nil)
((equal cl-list1 cl-list2) t)
(t (cl-parsing-keywords (:key) (:test :test-not)
***************
*** 815,852 ****
(defun subst-if (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements matching PREDICATE in TREE (non-destructively).
Return a copy of TREE with all matching elements replaced by NEW.
! Keywords supported: :key"
(apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
(defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elts not matching PREDICATE in TREE (non-destructively).
Return a copy of TREE with all non-matching elements replaced by NEW.
! Keywords supported: :key"
(apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
(defun nsubst (cl-new cl-old cl-tree &rest cl-keys)
"Substitute NEW for OLD everywhere in TREE (destructively).
Any element of TREE which is `eql' to OLD is changed to NEW (via a call
to `setcar').
! Keywords supported: :test :test-not :key"
(apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys))
(defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements matching PREDICATE in TREE (destructively).
Any element of TREE which matches is changed to NEW (via a call to `setcar').
! Keywords supported: :key"
(apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
(defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements not matching PREDICATE in TREE (destructively).
Any element of TREE which matches is changed to NEW (via a call to `setcar').
! Keywords supported: :key"
(apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
(defun sublis (cl-alist cl-tree &rest cl-keys)
"Perform substitutions indicated by ALIST in TREE (non-destructively).
Return a copy of TREE with all matching elements replaced.
! Keywords supported: :test :test-not :key"
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(cl-sublis-rec cl-tree)))
--- 864,907 ----
(defun subst-if (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements matching PREDICATE in TREE (non-destructively).
Return a copy of TREE with all matching elements replaced by NEW.
! \nKeywords supported: :key
! \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
(defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elts not matching PREDICATE in TREE (non-destructively).
Return a copy of TREE with all non-matching elements replaced by NEW.
! \nKeywords supported: :key
! \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
(defun nsubst (cl-new cl-old cl-tree &rest cl-keys)
"Substitute NEW for OLD everywhere in TREE (destructively).
Any element of TREE which is `eql' to OLD is changed to NEW (via a call
to `setcar').
! \nKeywords supported: :test :test-not :key
! \n(fn NEW OLD TREE [KEYWORD VALUE]...)"
(apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys))
(defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements matching PREDICATE in TREE (destructively).
Any element of TREE which matches is changed to NEW (via a call to `setcar').
! \nKeywords supported: :key
! \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
(defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements not matching PREDICATE in TREE (destructively).
Any element of TREE which matches is changed to NEW (via a call to `setcar').
! \nKeywords supported: :key
! \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
(defun sublis (cl-alist cl-tree &rest cl-keys)
"Perform substitutions indicated by ALIST in TREE (non-destructively).
Return a copy of TREE with all matching elements replaced.
! \nKeywords supported: :test :test-not :key
! \n(fn ALIST TREE [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(cl-sublis-rec cl-tree)))
***************
*** 867,873 ****
(defun nsublis (cl-alist cl-tree &rest cl-keys)
"Perform substitutions indicated by ALIST in TREE (destructively).
Any matching element of TREE is changed via a call to `setcar'.
! Keywords supported: :test :test-not :key"
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(let ((cl-hold (list cl-tree)))
(cl-nsublis-rec cl-hold)
--- 922,929 ----
(defun nsublis (cl-alist cl-tree &rest cl-keys)
"Perform substitutions indicated by ALIST in TREE (destructively).
Any matching element of TREE is changed via a call to `setcar'.
! \nKeywords supported: :test :test-not :key
! \n(fn ALIST TREE [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key :if :if-not) ()
(let ((cl-hold (list cl-tree)))
(cl-nsublis-rec cl-hold)
***************
*** 888,896 ****
(setq cl-tree (cdr cl-tree))))))
(defun tree-equal (cl-x cl-y &rest cl-keys)
! "Return t if trees X and Y have `eql' leaves.
Atoms are compared by `eql'; cons cells are compared recursively.
! Keywords supported: :test :test-not :key"
(cl-parsing-keywords (:test :test-not :key) ()
(cl-tree-equal-rec cl-x cl-y)))
--- 944,953 ----
(setq cl-tree (cdr cl-tree))))))
(defun tree-equal (cl-x cl-y &rest cl-keys)
! "Return t if trees TREE1 and TREE2 have `eql' leaves.
Atoms are compared by `eql'; cons cells are compared recursively.
! \nKeywords supported: :test :test-not :key
! \n(fn TREE1 TREE2 [KEYWORD VALUE]...)"
(cl-parsing-keywords (:test :test-not :key) ()
(cl-tree-equal-rec cl-x cl-y)))