Function: gnus-sorted-complement

gnus-sorted-complement is an autoloaded and byte-compiled function defined in gnus-range.el.gz.

Signature

(gnus-sorted-complement LIST1 LIST2)

Documentation

Return a list of elements that are in LIST1 or LIST2 but not both.

Both lists have to be sorted over <.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-range.el.gz
;;;###autoload
(defun gnus-sorted-complement (list1 list2)
  "Return a list of elements that are in LIST1 or LIST2 but not both.
Both lists have to be sorted over <."
  (let (out)
    (if (or (null list1) (null list2))
	(or list1 list2)
      (while (and list1 list2)
	(cond ((= (car list1) (car list2))
	       (setq list1 (cdr list1)
		     list2 (cdr list2)))
	      ((< (car list1) (car list2))
	       (setq out (cons (car list1) out))
	       (setq list1 (cdr list1)))
	      (t
	       (setq out (cons (car list2) out))
	       (setq list2 (cdr list2)))))
      (nconc (nreverse out) (or list1 list2)))))