(define (tfr t) (if (pair? t) (let s ((t t)) (if (pair? (car t)) (s (cons (caar t) (cons (cdar t) (cdr t)))) t)) (cons t #f))) (define (sf x y) (let ((x (tfr x)) (y (tfr y))) (and (eq? (car x) (car y)) (or (not (or (cdr x) (cdr y))) (sf (cdr x) (cdr y)))))) ; 37 paren pairs