(defun tree-max (list)
  (loop for elt in list
        if (realp elt) maximizing elt
        else if (consp elt) maximizing (tree-max elt)))