SICP Exercise Pointers
This module earns its content from implemented artifacts (the interpreter, the numerical library, the traces) rather than worked problem sets. But SICP's exercises are exceptionally well-crafted and a targeted selection reinforces every cluster. Use these as optional deepening, not as required completion.
How To Use This Page
- Finish the relevant concept page first.
- Attempt the matching practice task from memory.
- Only then open the matching SICP exercise.
- Keep a mistake log tagged with entries like
used car/cdr above the barrier,closure captured the wrong environment,evaluated both branches of if,reached for set! before trying an accumulator,non-tail recursion killed my Python stack.
Cluster 1: Abstraction as the Engineering Move
SICP §1.1 and §2.1 both carry this cluster. A good minimum is to do three or four of these.
- SICP 1.3 -- square-root by Newton's method. Practice procedural abstraction by factoring out
good-enough?,improve,sqrt-iter. - SICP 1.6 -- Alyssa's
new-ifas an ordinary procedure. This is the clearest single illustration of whyifmust be a special form (see Concept 08 and Quiz Q9). - SICP 2.1 -- design the rational-number ADT. Normalize to lowest terms.
- SICP 2.2 -- design a point and segment ADT with constructors, selectors, and a
midpoint-segmentoperation. - SICP 2.3 --
make-rect,width-rect,height-rectwith two representations. The classic exercise on picking constructors and selectors. - SICP 2.4 / 2.5 -- alternate representations of
consusing only procedures -- a shock therapy for "what is data, really?"
Chunk reinforcements:
- SICP 1.1.4 Compound procedures
- SICP 1.1.8 Procedures as black-box abstractions
- SICP 2.1.2 Abstraction barriers
Cluster 2: Higher-Order Procedures and Closures
- SICP 1.29 -- Simpson's rule as a HOF.
- SICP 1.30 --
sumas an iterative process (tail-recursive helper). Preview of Cluster 3. - SICP 1.31 / 1.32 --
productandaccumulateas direct generalizations ofsum. - SICP 1.33 --
filtered-accumulate-- the HOF that mergesfilterandreducein one shot. - SICP 1.40 / 1.41 / 1.42 --
cubic,double,compose. A short ladder into composition. - SICP 1.43 / 1.46 -- repeated application; iterative improvement as a HOF. Closures over procedures.
- SICP 2.23 --
for-each, written in terms of other HOFs.
Chunk reinforcements:
- SICP 1.3.1 Procedures as arguments
- SICP 1.3.4 Procedures as returned values
- SICP 2.2.3 Sequences as conventional interfaces
Cluster 3: Evaluation Models
- SICP 1.4 -- define
a-plus-abs-busing an operator chosen byif. Small but crisp; forces substitution thinking. - SICP 1.5 -- Ben's applicative/normal-order test. Canonical way to observe the difference, with a divergent procedure.
- SICP 1.9 -- trace two different definitions of
+using substitution; classify one as recursive process, the other as iterative. - SICP 3.9 -- trace
factorialin the environment model. The exercise for drawing frames. - SICP 3.10 -- trace
make-withdrawin the environment model. Adds the twist thatletis((lambda (...) ...) ...)behind the scenes. - SICP 3.11 -- trace
make-accountsimilarly; confirms closures + frames.
Chunk reinforcements:
- SICP 1.1.5 Substitution model
- SICP 1.2 Procedures and processes
- SICP 3.2.1 The rules for evaluation
- SICP 3.2.3 Frames as the repository of local state
Cluster 4: Metacircular and Interpreter Design
The exercises in Chapter 4 are substantial; pick two or three.
- SICP 4.1 -- change
list-of-valuesto enforce left-to-right (or right-to-left) argument evaluation. One line of code; deep ramifications. - SICP 4.2 -- Louis's "move application before conditionals" bug. The quiz-style question in book form.
- SICP 4.3 -- rewrite
evalas data-directed dispatch (a table of handlers keyed by tag). - SICP 4.4 -- add
andandoras special forms, then as derived expressions. - SICP 4.6 -- implement
letas a derived expression. - SICP 4.7 -- implement
let*in terms oflet. - SICP 4.22 -- extend the analyzing evaluator to handle
let. - SICP 5.1 -- draw a register-machine diagram for GCD. Connects interpretation to the machine layer (motivates Concept 12).
Chunk reinforcements:
- SICP 4.1.1 The core of the evaluator
- SICP 4.1.3 Evaluator data structures
- SICP 4.1.7 Separating syntactic analysis from execution
Cluster 5: State, Mutation, and Language Design
- SICP 3.1 --
make-accumulator. First closure over mutable state. - SICP 3.2 --
make-monitored. Adds ahow-many-calls?message. - SICP 3.3 / 3.4 --
make-accountwith passwords. Discipline for what counts as object identity. - SICP 3.8 -- a procedure whose effect depends on evaluation order. Concrete proof that order of operand evaluation is observable once mutation is in the language.
- SICP 3.50 / 3.52 -- stream map and lazy evaluation traces. Concrete training in "what happened when."
- SICP 3.53 / 3.54 -- self-referential streams. Fibonacci as a stream equation.
- SICP 3.38 / 3.39 -- concurrency: predicting possible outcomes of interleaved assignments. Quick, eye-opening.
- SICP 3.42 / 3.43 -- reasoning about serializers and shared mutable state.
Chunk reinforcements:
- SICP 3.1.1 Local state variables
- SICP 3.1.3 Costs of introducing assignment
- SICP 3.5.2 Infinite streams
- SICP 3.4.1 The nature of time in concurrent systems
Suggested Minimum Set
If you can only afford one exercise per cluster, do these:
- Cluster 1: SICP 2.2 (segments ADT) -- shortest worked data-abstraction example
- Cluster 2: SICP 1.33 (
filtered-accumulate) -- highest leverage HOF exercise - Cluster 3: SICP 3.10 (
make-withdrawtrace) -- the canonical environment-model drill - Cluster 4: SICP 4.1 (evaluation order) -- the one-line change that teaches everything
- Cluster 5: SICP 3.1 (
make-accumulator) -- minimal closure-with-state exercise
Completion Checklist
- At least one exercise completed per cluster
- Every exercise solved independently before opening the book's answer discussion
- A mistake log with at least 6 real, tagged entries
- At least one exercise re-attempted cold after a delay of ≥ 2 days