Function: hierarchy-equal
hierarchy-equal is a byte-compiled function defined in
hierarchy.el.gz.
Signature
(hierarchy-equal HIERARCHY1 HIERARCHY2)
Documentation
Return t if HIERARCHY1 and HIERARCHY2 are equal.
Two equal hierarchies share the same items and the same relationships among them.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/hierarchy.el.gz
(defun hierarchy-equal (hierarchy1 hierarchy2)
"Return t if HIERARCHY1 and HIERARCHY2 are equal.
Two equal hierarchies share the same items and the same
relationships among them."
(and (hierarchy-p hierarchy1)
(hierarchy-p hierarchy2)
(= (hierarchy-length hierarchy1) (hierarchy-length hierarchy2))
;; parents are the same
(seq-every-p (lambda (child)
(equal (hierarchy-parent hierarchy1 child)
(hierarchy-parent hierarchy2 child)))
(map-keys (hierarchy--parents hierarchy1)))
;; children are the same
(seq-every-p (lambda (parent)
(hierarchy--set-equal
(hierarchy-children hierarchy1 parent)
(hierarchy-children hierarchy2 parent)
:test #'equal))
(map-keys (hierarchy--children hierarchy1)))))