(define (atom? x) (not (pair? x))) (define nil '()) (define (subsets s) (if (null? s) (list nil) (let ((rest (subsets (cdr s))) (first (list (car s)))) (append (map (lambda (x) (if (eq? x nil) first (append first x))) rest) rest)))) (subsets (list 1 2 3))