; McCarthy's from LISP (define (samefringe tree1 tree2) (or (eq? tree1 tree2) (and (pair? tree1) (pair? tree2) (same (gopher tree1) (gopher tree2))))) (define (same x y) (and (eq? (car x) (car y)) (samefringe (cdr x) (cdr y)))) (define (gopher tree) (cond ((not (pair? (car tree))) tree) (#t (gopher (cons (caar tree) (cons (cdar tree) (cdr tree))))))) ; 33 paren pairs