Function: gnus-sorted-nunion

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

Signature

(gnus-sorted-nunion LIST1 LIST2)

Documentation

Return union of LIST1 and LIST2 by modifying cdr pointers of LIST1.

LIST1 and LIST2 have to be sorted over <.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-range.el.gz
;;;###autoload
(defun gnus-sorted-nunion (list1 list2)
  "Return union of LIST1 and LIST2 by modifying cdr pointers of LIST1.
LIST1 and LIST2 have to be sorted over <."
  (let* ((top (cons nil list1))
	 (prev top))
    (while (and list1 list2)
      (cond ((= (car list1) (car list2))
	     (setq prev list1
		   list1 (cdr list1)
		   list2 (cdr list2)))
	    ((< (car list1) (car list2))
	     (setq prev list1
		   list1 (cdr list1)))
	    (t
	     (setcdr prev (list (car list2)))
	     (setq prev (cdr prev)
		   list2 (cdr list2))
	     (setcdr prev list1))))
    (while list2
      (setcdr prev (list (car list2)))
      (setq prev (cdr prev)
	    list2 (cdr list2)))
    (cdr top)))