;;; symmetric tree ;;; predicate, returns t when the right subtree is the mirror image of ;;; the left subtree (ignoring content) (defun symmetric (tree) (or (null tree) (equal-structure (second tree) (revert (third tree))) ) ) (defun revert (tree) (if (null tree) () (list (first tree) (revert (third tree)) (revert (second tree))) ) ) (defun equal-structure (t1 t2) (cond ((null t1) (null t2)) ((null t2) nil) (t (and (equal-structure (second t1) (second t2)) (equal-structure (third t1) (third t2)) ) ) ) )