anchor.diff:                                  :left (make-s-diet-node :bottom bottom :top (1- a-val) :left left :right nil)))))))))
   
   (defun diet-height (a-tree)
  -  (cond
  -    ((null a-tree) 0)
  -    ((and (null (s-diet-node-right a-tree)) (null (s-diet-node-left a-tree))) 0)
  -    ((null (s-diet-node-left a-tree)) (1+ (diet-height (s-diet-node-right a-tree))))
  -    ((null (s-diet-node-right a-tree)) (1+ (diet-height (s-diet-node-left a-tree))))
  -    (t 
  -     (1+ (max (diet-height (s-diet-node-right a-tree))
  -               (diet-height (s-diet-node-left a-tree)))))))
  +  (if (null a-tree)
  +      0
  +      (with-slots (left right) a-tree
  +        (cond
  +          ((and (null right) (null left)) 0)
  +          ((null left) (1+ (diet-height right)))
  +          ((null right) (1+ (diet-height left)))
  +          (t
  +           (1+ (max (diet-height right) (diet-height left))))))))
   
   (defun diet-balance (a-tree)
     (cond
  
positive.code:     (t a-diet-node)))
  
  (defun diet-merge (a-tree)
    (cond
      ((null (s-diet-node-right a-tree)) (s-diet-node-left a-tree))
      ((null (s-diet-node-left a-tree)) (s-diet-node-right a-tree))
      (t
       (if (zerop (random 2))
           (multiple-value-bind (bottom top new-left-subtree)
               (split-max (s-diet-node-left a-tree))
             (make-s-diet-node :bottom bottom :top top
                               :left new-left-subtree :right (s-diet-node-right a-tree)))
           (multiple-value-bind (bottom top new-right-subtree)
               (split-min (s-diet-node-right a-tree))
             (make-s-diet-node :bottom bottom :top top
                               :left (s-diet-node-left a-tree) :right new-right-subtree))))))
  
  (defun diet-remove (a-val a-tree)
    (cond
  
negative.code:           (diet-height (s-diet-node-left a-tree))))))
  
  (defun diet-max-interval (a-tree)
    (if (null a-tree)
        (values 0 nil)
        (with-slots (bottom top left right) a-tree
          (let ((curr-interval (1+ (- top bottom))))
            (cond
              ((and (null left) (null right)) (values curr-interval a-tree))
              ((null left) (multiple-value-bind (max-subtree-interval node) (diet-max-interval right)
                             (if (> max-subtree-interval curr-interval)
                                 (values max-subtree-interval node)
                                 (values curr-interval a-tree))))
              ((null right) (multiple-value-bind (max-subtree-interval node) (diet-max-interval left)
                               (if (> max-subtree-interval curr-interval)
                                   (values max-subtree-interval node)
                                   (values curr-interval a-tree))))
              (t
               (multiple-value-bind (max-left-int max-left-node)
                   (diet-max-interval left)
                 (multiple-value-bind (max-right-int max-right-node)
                     (diet-max-interval right)
                   (if (> max-left-int max-right-int)
                       (values max-left-int max-left-node)
                       (values max-right-int max-right-node))))))))))
  
  (defun diet-r-rotate (a-tree)
    (if (null a-tree)
        nil
        (with-slots ((l left) (r right)) a-tree
          (if (or (null l) (null r))
              a-tree
              (with-slots ((ll left) (lr right)) l
                (make-s-diet-node :bottom (s-diet-node-bottom l) :top (s-diet-node-top l)
                                  :left ll
                                  :right (make-s-diet-node :bottom (s-diet-node-bottom a-tree) :top (s-diet-node-top a-tree)
  