# SICP Solutions: Section 2.2.1

## Section 2.2 - Hierarchical Data and the Closure Property

### Section 2.2.1 - Representing Sequences

#### Exercise 2.17

#### Exercise 2.18

This is the iterative version:

We can use `append`

to create a recursive version:

But this will be more expensive because `append`

will iterate over each subset.

#### Exercise 2.19

The three procedures are really simple actually, just renaming the list-operating procedures.

The order of list `coin-values`

does not affect the answer produced by `cc`

.
This is because the procedure is not based on any assumption regarding the order
of the elements.

#### Exercise 2.20

#### Exercise 2.21

#### Exercise 2.22

Louis’ solution is essentially how we implemented `reverse`

for exercise 2.18.
Each iteration creates something like `(cons 9 (cons 4 (cons 1 nil)))`

,
which is exactly how lists are implemented.

Unfortunately the second solution is no good either, because it is the inverse
of how lists are implemented, and results into something like
`(cons (cons (cons nil 1) 4) 9)`

. The order is correct, but this isn’t how
Scheme structures lists from `cons`

cells.