Building Abstractions with Procedures
Structure and Interpretation of Computer Programs
A computational process, as described by Abelson, Sussman, and Sussman (1996, 1), is anything a computer can be made to do. Computational processes are abstract and intangible like numbers and integrals, but similarly profound. Computers are made to perform computational processes via programs, written in programming languages.
Procedures are aspects of computational processes that receive inputs and return outputs, similar to mathematical functions. The inputs and outputs may be thought of as data, interpreted broadly: they can include numbers but also procedures themselves. Chapter 1 of Abelson, Sussman, and Sussman (1996) is concerned with gradually building complex computational processes using procedures of gradually increasing complexity. Chapter 2 is concerned with gradually building complex computational processes using data of gradually increasing complexity. A key idea in this chapter and the next is specifying complex computational processes gradually, beginning with fundamental building blocks. Fundamental building blocks A and B are used to build object C, which is then used to build the more complex object D, and so on.
Notes
- 1.1: The Elements of Programming
- 1.1.1: Expressions
- 1.1.2: Naming and the Environment
- 1.1.3: Evaluating Combinations
- 1.1.4: Compound Procedures
- 1.1.5: The Substitution Model for Procedure Application
- 1.1.6: Conditional Expressions and Predicates
- 1.1.7: Example: Square Roots by Newton’s Method
- 1.1.8: Procedures as Black-Box Abstractions
Exercises
- 1.1: Interpret expressions
- 1.2: Prefix notation
- 1.3: Largest two of three numbers
- 1.4: Compound operator
- 1.5: Applicative- and normal-order evaluation
- 1.6: <code>if</code> as procedure
- 1.7: Rewrite <code>good-enough?</code>
- 1.8: Cube-root approximation