(defun apply-right-rotations (node) (when node (when-bind left (left node) (when (> (height-diff node) 1) (if (< (node-height (left left)) (node-height (right left))) (setf node (double-rotate-right node)) (setf node (single-rotate-right node))))) node))Source Context