Function: eieio--c3-merge-lists
eieio--c3-merge-lists is a byte-compiled function defined in
eieio-core.el.gz.
Signature
(eieio--c3-merge-lists REVERSED-PARTIAL-RESULT REMAINING-INPUTS)
Documentation
Try to merge REVERSED-PARTIAL-RESULT REMAINING-INPUTS in a consistent order.
If a consistent order does not exist, signal an error.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio-core.el.gz
(defun eieio--c3-merge-lists (reversed-partial-result remaining-inputs)
"Try to merge REVERSED-PARTIAL-RESULT REMAINING-INPUTS in a consistent order.
If a consistent order does not exist, signal an error."
(setq remaining-inputs (delq nil remaining-inputs))
(if (null remaining-inputs)
;; If all remaining inputs are empty lists, we are done.
(nreverse reversed-partial-result)
;; Otherwise, we try to find the next element of the result. This
;; is achieved by considering the first element of each
;; (non-empty) input list and accepting a candidate if it is
;; consistent with the rests of the input lists.
(let* ((found nil)
(tail remaining-inputs)
(next (progn
(while (and tail (not found))
(setq found (eieio--c3-candidate (caar tail)
remaining-inputs)
tail (cdr tail)))
found)))
(if next
;; The graph is consistent so far, add NEXT to result and
;; merge input lists, dropping NEXT from their heads where
;; applicable.
(eieio--c3-merge-lists
(cons next reversed-partial-result)
(mapcar (lambda (l) (if (eq (cl-first l) next) (cl-rest l) l))
remaining-inputs))
;; The graph is inconsistent, give up
(signal 'inconsistent-class-hierarchy (list remaining-inputs))))))