anchor.diff:    (mapcar #'value (all-children history)))
   
   
  +
  +(defun disowned-branch-nodes (node)
  +  "Return list of all NODE's children (including NODE) if they are all disowned.
  +Return nil otherwise."
  +  (let ((disowned? t)
  +        (children '()))
  +    (block nil
  +      (do-tree (child-node node)
  +        (unless (disowned-p child-node)
  +          (setf disowned? nil)
  +          (return))
  +        (push child-node children)))
  +    (when disowned?
  +      children)))
  +
  +(defun delete-node (history node)
  +  (cl-custom-hash-table:with-custom-hash-table
  +    (alexandria:deletef (gethash (entry node) (entries history)) node)))
  +
  +(defun delete-disowned-branch-nodes (history owner)
  +  ;; We memoize the deleted nodes to avoid retraversing the branch for all the
  +  ;; nodes that belong to the same branch.
  +  (let ((deleted-nodes '()))
  +    (labels ((garbage-collect (list-of-nodes)
  +               (when list-of-nodes
  +                 (let* ((node (first list-of-nodes))
  +                        (root (root node)))
  +                   (unless (find node deleted-nodes)
  +                     (let ((disowned-nodes (disowned-branch-nodes root)))
  +                       (when disowned-nodes
  +                         (dolist (node deleted-nodes)
  +                           (delete-node history node))
  +                         (setf deleted-nodes
  +                               (append disowned-nodes
  +                                       deleted-nodes))))))
  +                 (garbage-collect (rest list-of-nodes)))))
  +      (garbage-collect (nodes owner)))))
  +
   (defun first-hash-table-value (hash-table)
     (with-hash-table-iterator (next-entry hash-table)
       (nth-value 2 (next-entry))))
   
   (declaim (ftype (function (history-tree t) (or null owner)) delete-owner))
   (defun delete-owner (history owner-identifier)
  -  "Return owner, or nil if there is no owner corresponding to OWNER-IDENTIFIER."
  +  "Delete `owner' corresponding to OWNER-IDENTIFIER from HISTORY.
  +For every branch `owner' has nodes on, remove all its nodes if the branch is
  +without any owner.
  +Return owner, or nil if there is no owner corresponding to OWNER-IDENTIFIER."
     (let ((owner (owner owner-identifier history)))
       (remhash owner-identifier (owners history))
       (when (eq owner (current-owner history))
  
positive.code: (defmethod value ((node node))
    (value (entry node)))
  
  (defun make-node (&key parent entry) ; TODO: Useless?
    (make-instance 'node :parent parent :entry entry))
  
  
negative.code: ;; TODO: Is "Shared history tree" a better name than "Global history tree"?
  
  ;; TODO: Turn unique defmethod to defuns.
  ;; TODO: Thread safe?
  
  ;; TODO: Add forward and back functions to unowned nodes.
  ;; TODO: Should we have different functions for finding nodes vs. "owned nodes",
  ;; or pass an option as key argument?
  
  