# Exercise 2.39

```
(define (subsets s)
(if (null? s)
(list nil)
(let ((rest (subsets (cdr s))))
(append rest (map (lambda (v) (append (list (car s)) v)) rest)))))
```

This works because the power set of a set is the union of the subsets not using one element and the subsets using this element.\ Here is the mathematical representation of the idea we used in our procedure: \((\{x_1,x_2,…,x_n\})=(\{x_2,x_3,…,x_n\})\{x_1X:X(\{x_2,x_3,…,x_n\})\}\)