Quirksand

SICP

SICP 1.3.4 Exercises

December 13, 2013 14:25

This section continues to deal with numerical solvers, with some slightly more complex methods. They’re also allowing a bit more abstraction, which can prove quite useful. Functions are now being passed around not just as arguments but as the result of procedures. The result of the procedure often gets used as an argument for another procedure, or even back to the original procedure itself.

The idea of the first-class element indeed gets at the heart of what differentiates many programming languages. Since LISP is one in which everything has this status, it is at once both simple and powerful. (Note that ‘simple’ does not necessarily mean ‘better’). This is the close of Chapter 1, and Chapter 2 begins a closer look at manipulating data, but as you continue through it keep in mind that anything that is first-class is usable as a piece of data.

Several of the tests I’ve included in the exercise file also have optional ‘invalid’ value tests, currently disabled. There generally is no defined behavior within the problem statement for these cases, so there is no need to modify any solution to ‘accept’ them. It’s not a bad idea, though to figure out what response invalid input can yield. It can often help improve the program, and give you some practice in identifying the response to unexpected input.

Exercises 1.3.4