;; flatten down to a list of atoms (define (flatten list) (cond ((null? list) '()) ((list? (car list)) (append (flatten (car list)) (flatten (cdr list)))) (else (cons (car list) (flatten (cdr list))))))