SICP

# SICP 2.1.2 Exercises

February 10, 2014 20:11

This section gets to some of the more philosophical ideas about data. Exactly what a piece of data is, and what it means to process it can lead to rather interesting notions of representation. Church numerals arose as a tool in the lambda calculus, which is a means of peforming operations that manipulate functions. A look back at Section 1.3 (in particular Exercise 1.41) may prove useful in understanding how those ideas can be extended to create a system of arithmetic.

The additional tests provided here also demonstrate a key concept in this topic. Namely, they don’t test the representations themselves, but how they perform. Any of the rewritten methods of `cons`

, `car`

, or `cdr`

ought to work exactly the same as the built-in Scheme procedures, at least for the domain of the exercise. That the data can be represented in a way that does not change how it might be used shows how abstraction barriers provide flexibility in creating programs. It does mean that the tests themselves are not necessarily an accurate method for proving that the exercises were correctly solved, however.