(define (flat a)
(cond ((list? a) (apply append (map flat a)))
((pair? a) (append (flat (list (car a) (cdr a)))))
(else (list a))))
とかかけてequal?したらダメ?