├── README ├── content ├── book-Z-C.css ├── book-Z-G-D-11.gif ├── book-Z-G-D-12.gif ├── book-Z-G-D-13.gif ├── book-Z-G-D-14.gif ├── book-Z-G-D-15.gif ├── book-Z-G-D-16.gif ├── book-Z-G-D-17.gif ├── book-Z-G-D-18.gif ├── book-Z-G-D-19.gif ├── book-Z-G-D-20.gif ├── book-Z-G-D-3.gif ├── book-Z-G-D-4.gif ├── book-Z-G-D-6.gif ├── book-Z-G-D-9.gif ├── book-Z-H-1.html ├── book-Z-H-10.html ├── book-Z-H-11.html ├── book-Z-H-12.html ├── book-Z-H-13.html ├── book-Z-H-14.html ├── book-Z-H-15.html ├── book-Z-H-16.html ├── book-Z-H-17.html ├── book-Z-H-18.html ├── book-Z-H-19.html ├── book-Z-H-2.html ├── book-Z-H-20.html ├── book-Z-H-21.html ├── book-Z-H-22.html ├── book-Z-H-23.html ├── book-Z-H-24.html ├── book-Z-H-25.html ├── book-Z-H-26.html ├── book-Z-H-27.html ├── book-Z-H-28.html ├── book-Z-H-29.html ├── book-Z-H-3.html ├── book-Z-H-30.html ├── book-Z-H-31.html ├── book-Z-H-32.html ├── book-Z-H-33.html ├── book-Z-H-34.html ├── book-Z-H-35.html ├── book-Z-H-36.html ├── book-Z-H-37.html ├── book-Z-H-38.html ├── book-Z-H-4.html ├── book-Z-H-5.html ├── book-Z-H-6.html ├── book-Z-H-7.html ├── book-Z-H-8.html ├── book-Z-H-9.html ├── cc-by-nc.png ├── ch1-Z-G-1.gif ├── ch1-Z-G-10.gif ├── ch1-Z-G-11.gif ├── ch1-Z-G-12.gif ├── ch1-Z-G-13.gif ├── ch1-Z-G-14.gif ├── ch1-Z-G-15.gif ├── ch1-Z-G-16.gif ├── ch1-Z-G-17.gif ├── ch1-Z-G-18.gif ├── ch1-Z-G-19.gif ├── ch1-Z-G-2.gif ├── ch1-Z-G-20.gif ├── ch1-Z-G-21.gif ├── ch1-Z-G-22.gif ├── ch1-Z-G-23.gif ├── ch1-Z-G-24.gif ├── ch1-Z-G-25.gif ├── ch1-Z-G-26.gif ├── ch1-Z-G-27.gif ├── ch1-Z-G-28.gif ├── ch1-Z-G-29.gif ├── ch1-Z-G-3.gif ├── ch1-Z-G-30.gif ├── ch1-Z-G-31.gif ├── ch1-Z-G-32.gif ├── ch1-Z-G-33.gif ├── ch1-Z-G-34.gif ├── ch1-Z-G-35.gif ├── ch1-Z-G-36.gif ├── ch1-Z-G-37.gif ├── ch1-Z-G-38.gif ├── ch1-Z-G-4.gif ├── ch1-Z-G-5.gif ├── ch1-Z-G-6.gif ├── ch1-Z-G-7.gif ├── ch1-Z-G-8.gif ├── ch1-Z-G-9.gif ├── ch2-Z-G-1.gif ├── ch2-Z-G-10.gif ├── ch2-Z-G-11.gif ├── ch2-Z-G-12.gif ├── ch2-Z-G-13.gif ├── ch2-Z-G-14.gif ├── ch2-Z-G-15.gif ├── ch2-Z-G-16.gif ├── ch2-Z-G-17.gif ├── ch2-Z-G-18.gif ├── ch2-Z-G-19.gif ├── ch2-Z-G-2.gif ├── ch2-Z-G-20.gif ├── ch2-Z-G-21.gif ├── ch2-Z-G-22.gif ├── ch2-Z-G-23.gif ├── ch2-Z-G-24.gif ├── ch2-Z-G-25.gif ├── ch2-Z-G-26.gif ├── ch2-Z-G-27.gif ├── ch2-Z-G-28.gif ├── ch2-Z-G-29.gif ├── ch2-Z-G-3.gif ├── ch2-Z-G-30.gif ├── ch2-Z-G-31.gif ├── ch2-Z-G-32.gif ├── ch2-Z-G-33.gif ├── ch2-Z-G-34.gif ├── ch2-Z-G-35.gif ├── ch2-Z-G-36.gif ├── ch2-Z-G-37.gif ├── ch2-Z-G-38.gif ├── ch2-Z-G-39.gif ├── ch2-Z-G-4.gif ├── ch2-Z-G-40.gif ├── ch2-Z-G-41.gif ├── ch2-Z-G-42.gif ├── ch2-Z-G-43.gif ├── ch2-Z-G-44.gif ├── ch2-Z-G-45.gif ├── ch2-Z-G-46.gif ├── ch2-Z-G-47.gif ├── ch2-Z-G-48.gif ├── ch2-Z-G-49.gif ├── ch2-Z-G-5.gif ├── ch2-Z-G-50.gif ├── ch2-Z-G-51.gif ├── ch2-Z-G-52.gif ├── ch2-Z-G-53.gif ├── ch2-Z-G-54.gif ├── ch2-Z-G-55.gif ├── ch2-Z-G-56.gif ├── ch2-Z-G-57.gif ├── ch2-Z-G-58.gif ├── ch2-Z-G-59.gif ├── ch2-Z-G-6.gif ├── ch2-Z-G-60.gif ├── ch2-Z-G-61.gif ├── ch2-Z-G-62.gif ├── ch2-Z-G-63.gif ├── ch2-Z-G-64.gif ├── ch2-Z-G-65.gif ├── ch2-Z-G-66.gif ├── ch2-Z-G-67.gif ├── ch2-Z-G-68.gif ├── ch2-Z-G-69.gif ├── ch2-Z-G-7.gif ├── ch2-Z-G-70.gif ├── ch2-Z-G-71.gif ├── ch2-Z-G-72.gif ├── ch2-Z-G-73.gif ├── ch2-Z-G-74.gif ├── ch2-Z-G-75.gif ├── ch2-Z-G-76.gif ├── ch2-Z-G-77.gif ├── ch2-Z-G-78.gif ├── ch2-Z-G-79.gif ├── ch2-Z-G-8.gif ├── ch2-Z-G-80.gif ├── ch2-Z-G-81.gif ├── ch2-Z-G-9.gif ├── ch3-Z-G-1.gif ├── ch3-Z-G-10.gif ├── ch3-Z-G-11.gif ├── ch3-Z-G-12.gif ├── ch3-Z-G-13.gif ├── ch3-Z-G-14.gif ├── ch3-Z-G-15.gif ├── ch3-Z-G-16.gif ├── ch3-Z-G-17.gif ├── ch3-Z-G-18.gif ├── ch3-Z-G-19.gif ├── ch3-Z-G-2.gif ├── ch3-Z-G-20.gif ├── ch3-Z-G-21.gif ├── ch3-Z-G-22.gif ├── ch3-Z-G-23.gif ├── ch3-Z-G-24.gif ├── ch3-Z-G-25.gif ├── ch3-Z-G-26.gif ├── ch3-Z-G-27.gif ├── ch3-Z-G-28.gif ├── ch3-Z-G-29.gif ├── ch3-Z-G-3.gif ├── ch3-Z-G-30.gif ├── ch3-Z-G-31.gif ├── ch3-Z-G-32.gif ├── ch3-Z-G-33.gif ├── ch3-Z-G-34.gif ├── ch3-Z-G-35.gif ├── ch3-Z-G-36.gif ├── ch3-Z-G-37.gif ├── ch3-Z-G-38.gif ├── ch3-Z-G-39.gif ├── ch3-Z-G-4.gif ├── ch3-Z-G-40.gif ├── ch3-Z-G-41.gif ├── ch3-Z-G-42.gif ├── ch3-Z-G-43.gif ├── ch3-Z-G-44.gif ├── ch3-Z-G-45.gif ├── ch3-Z-G-46.gif ├── ch3-Z-G-47.gif ├── ch3-Z-G-48.gif ├── ch3-Z-G-49.gif ├── ch3-Z-G-5.gif ├── ch3-Z-G-50.gif ├── ch3-Z-G-51.gif ├── ch3-Z-G-52.gif ├── ch3-Z-G-53.gif ├── ch3-Z-G-54.gif ├── ch3-Z-G-55.gif ├── ch3-Z-G-56.gif ├── ch3-Z-G-57.gif ├── ch3-Z-G-58.gif ├── ch3-Z-G-59.gif ├── ch3-Z-G-6.gif ├── ch3-Z-G-60.gif ├── ch3-Z-G-7.gif ├── ch3-Z-G-8.gif ├── ch3-Z-G-9.gif ├── ch4-Z-G-1.gif ├── ch4-Z-G-10.gif ├── ch4-Z-G-2.gif ├── ch4-Z-G-3.gif ├── ch4-Z-G-4.gif ├── ch4-Z-G-5.gif ├── ch4-Z-G-6.gif ├── ch4-Z-G-7.gif ├── ch4-Z-G-8.gif ├── ch4-Z-G-9.gif ├── ch5-Z-G-1.gif ├── ch5-Z-G-2.gif ├── ch5-Z-G-3.gif ├── ch5-Z-G-4.gif ├── ch5-Z-G-5.gif ├── ch5-Z-G-6.gif ├── ch5-Z-G-7.gif ├── ch5-Z-G-8.gif ├── ch5-Z-G-9.gif ├── chip.jpg ├── cover.jpg ├── sicp.opf └── toc.ncx ├── lib ├── build_book.rb ├── properties.rb └── tags.ruby └── sicp.mobi /README: -------------------------------------------------------------------------------- 1 | Slight reformatting of the pages at http://mitpress.mit.edu/sicp/full-text/book/book.html 2 | 3 | 1 - I got the source: 4 | wget -r http://mitpress.mit.edu/sicp/full-text/book/book.html 5 | 6 | 2 - used hpricot to: 7 | - remove 'navigation' divs 8 | - insert tags at the top of each html body ( this keeps lines from getting split ) 9 | 10 | 3 - removed cover page 'book.html' since there's already a cover image 11 | 12 | 4 - set text-indent: 0 for

tags, since kindle indents about 1em by default, which deformatted the code snips (

is used instead of

)
13 | 
14 | 5 - set height="2em" on div tags in 'References' section (kindle doesn't support the CSS for controlling this)
15 | 
16 | 6 - added jump table to top of index
17 | 
18 | 7 - built opf and ncx with ruby.  toc.ncx allows 'nav points' for the 5-way kindle knob to get you from chapter to chapter
19 | 
20 | 
21 | TODO: fix image at Figure 1.1, the tree diagram.  (comes out darkened for some reason)
22 | TODO: read the damn book!
23 | 


--------------------------------------------------------------------------------
/content/book-Z-C.css:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | body {
 4 |    color: black;
 5 | /*   background-color: #e5e5e5; */
 6 | /*   background-color: beige;*/
 7 | background-color: white;
 8 |    margin-top: 2em;
 9 |    margin-left: 8%;
10 |    margin-right: 8%;
11 | }
12 | 
13 | h1,h2,h3,h4,h5,h6 {
14 |    margin-top: .5em;
15 | }
16 | 
17 | .partheading {
18 |    font-size: 70%;
19 | }
20 | 
21 | .chapterheading {
22 |    font-size: 90%;
23 | }
24 | 
25 | ol {
26 |    list-style-type: decimal;
27 | }
28 | 
29 | ol ol {
30 |    list-style-type: lower-alpha;
31 | }
32 | 
33 | ol ol ol {
34 |    list-style-type: lower-roman;
35 | }
36 | 
37 | ol ol ol ol {
38 |    list-style-type: upper-alpha;
39 | }
40 | 
41 | .footnote {
42 |    font-size: 75%;
43 | }
44 | 
45 | .epigraph {
46 | /*   text-align: right; */
47 |    font-size: 75%; 
48 |    font-style: italic;
49 | } 
50 | 
51 | .attrib {
52 |   font-size: 75%;
53 |   font-style: normal;
54 | }
55 | .figure {
56 |  background-color: lavender;
57 | }
58 | 
59 | .table {
60 | background-color: pink;
61 | }
62 | 
63 | .smallprint {
64 |    color: gray;
65 |    font-size: 75%;
66 |    text-align: right;
67 | }
68 | 
69 | .smallprint hr {
70 |    text-align: left;
71 |    width: 40%;
72 | }
73 | 
74 | .disable {
75 |    /* color: #e5e5e5; */
76 | color: gray;
77 | }
78 | 
79 | p {
80 |     text-indent: 0;
81 |     margin: 0;
82 | }
83 | p + p {
84 |     text-indent: 1em;
85 | }
86 | 


--------------------------------------------------------------------------------
/content/book-Z-G-D-11.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-11.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-12.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-12.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-13.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-13.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-14.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-14.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-15.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-15.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-16.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-16.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-17.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-17.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-18.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-18.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-19.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-19.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-20.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-20.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-3.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-4.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-6.gif


--------------------------------------------------------------------------------
/content/book-Z-G-D-9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/book-Z-G-D-9.gif


--------------------------------------------------------------------------------
/content/book-Z-H-1.html:
--------------------------------------------------------------------------------
 1 | 
 3 | 
 4 | 
 5 | 
 7 | 
 8 | 
 9 |     
10 |     
11 | 
12 |     Structure and Interpretation of Computer Programs
13 |     
14 |     
15 | 
16 | 
17 | 
18 |     
19 | 
20 |     

                

21 | 22 |

Structure and Interpretation
23 | of Computer Programs

24 | 25 |
26 | second edition  27 |
28 | 29 |


30 | 31 |


32 | 33 |


34 | 35 |


36 | 37 |
38 | Harold Abelson and Gerald Jay Sussman
39 | with Julie Sussman  40 |
41 | 42 |
43 | foreword by Alan J. Perlis  44 |
45 | 46 |


47 | 48 |


49 | 50 |


51 | 52 |


53 | 54 |


55 | 56 |


57 | 58 |
59 | The MIT Press
60 | Cambridge, Massachusetts     London, England 61 | 62 |

McGraw-Hill Book Company
63 | New York     St. Louis     San Francisco     Montreal     Toronto 

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /content/book-Z-H-13.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 |

Chapter 2

24 | 25 |

Building Abstractions with Data

26 |
27 | 28 |
29 | 30 | 31 | 40 | 41 |
32 |
33 | “We now come to the decisive step of mathematical abstraction: we forget about what the symbols stand for. [The mathematician] need not be idle; there are many operations which he may carry out with these symbols, without ever having to look at the things they stand for.” 34 |
35 | 36 |
37 | Hermann Weyl, The Mathematical Way of Thinking 38 |
39 |
42 |
43 | 44 |

We concentrated in chapter 1 on computational processes and on the role of procedures in program design. We saw how to use primitive data (numbers) and primitive operations (arithmetic operations), how to combine procedures to form compound procedures through composition, conditionals, and the use of parameters, and how to abstract procedures by using define. We saw that a procedure can be regarded as a pattern for the local evolution of a process, and we classified, reasoned about, and performed simple algorithmic analyses of some common patterns for processes as embodied in procedures. We also saw that higher-order procedures enhance the power of our language by enabling us to manipulate, and thereby to reason in terms of, general methods of computation. This is much of the essence of programming.

45 | 46 |

In this chapter we are going to look at more complex data. All the procedures in chapter 1 operate on simple numerical data, and simple data are not sufficient for many of the problems we wish to address using computation. Programs are typically designed to model complex phenomena, and more often than not one must construct computational objects that have several parts in order to model real-world phenomena that have several aspects. Thus, whereas our focus in chapter 1 was on building abstractions by combining procedures to form compound procedures, we turn in this chapter to another key aspect of any programming language: the means it provides for building abstractions by combining data objects to form compound data.

47 | 48 |

Why do we want compound data in a programming language? For the same reasons that we want compound procedures: to elevate the conceptual level at which we can design our programs, to increase the modularity of our designs, and to enhance the expressive power of our language. Just as the ability to define procedures enables us to deal with processes at a higher conceptual level than that of the primitive operations of the language, the ability to construct compound data objects enables us to deal with data at a higher conceptual level than that of the primitive data objects of the language.

49 | 50 |

Consider the task of designing a system to perform arithmetic with rational numbers. We could imagine an operation add-rat that takes two rational numbers and produces their sum. In terms of simple data, a rational number can be thought of as two integers: a numerator and a denominator. Thus, we could design a program in which each rational number would be represented by two integers (a numerator and a denominator) and where add-rat would be implemented by two procedures (one producing the numerator of the sum and one producing the denominator). But this would be awkward, because we would then need to explicitly keep track of which numerators corresponded to which denominators. In a system intended to perform many operations on many rational numbers, such bookkeeping details would clutter the programs substantially, to say nothing of what they would do to our minds. It would be much better if we could “glue together” a numerator and denominator to form a pair—a compound data object—that our programs could manipulate in a way that would be consistent with regarding a rational number as a single conceptual unit.

51 | 52 |

The use of compound data also enables us to increase the modularity of our programs. If we can manipulate rational numbers directly as objects in their own right, then we can separate the part of our program that deals with rational numbers per se from the details of how rational numbers may be represented as pairs of integers. The general technique of isolating the parts of a program that deal with how data objects are represented from the parts of a program that deal with how data objects are used is a powerful design methodology called data abstraction. We will see how data abstraction makes programs much easier to design, maintain, and modify.

53 | 54 |

The use of compound data leads to a real increase in the expressive power of our programming language. Consider the idea of forming a “linear combination” ax + by. We might like to write a procedure that would accept a, b, x, and y as arguments and return the value of ax + by. This presents no difficulty if the arguments are to be numbers, because we can readily define the procedure

55 | 56 |

(define (linear-combination a b x y) 
57 |   (+ (* a x) (* b y)))

58 | 59 |

But suppose we are not concerned only with numbers. Suppose we would like to express, in procedural terms, the idea that one can form linear combinations whenever addition and multiplication are defined—for rational numbers, complex numbers, polynomials, or whatever. We could express this as a procedure of the form

60 | 61 |

(define (linear-combination a b x y)     
62 |   (add (mul a x) (mul b y))) 

63 | 64 |

where add and mul are not the primitive procedures + and * but rather more complex things that will perform the appropriate operations for whatever kinds of data we pass in as the arguments a, b, x, and y. The key point is that the only thing linear-combination should need to know about a, b, x, and y is that the procedures add and mul will perform the appropriate manipulations. From the perspective of the procedure linear-combination, it is irrelevant what a, b, x, and y are and even more irrelevant how they might happen to be represented in terms of more primitive data. This same example shows why it is important that our programming language provide the ability to manipulate compound objects directly: Without this, there is no way for a procedure such as linear-combination to pass its arguments along to add and mul without having to know their detailed structure.1 We begin this chapter by implementing the rational-number arithmetic system mentioned above. This will form the background for our discussion of compound data and data abstraction. As with compound procedures, the main issue to be addressed is that of abstraction as a technique for coping with complexity, and we will see how data abstraction enables us to erect suitable abstraction barriers between different parts of a program.

65 | 66 |

We will see that the key to forming compound data is that a programming language should provide some kind of “glue” so that data objects can be combined to form more complex data objects. There are many possible kinds of glue. Indeed, we will discover how to form compound data using no special “data” operations at all, only procedures. This will further blur the distinction between “procedure” and “data,” which was already becoming tenuous toward the end of chapter 1. We will also explore some conventional techniques for representing sequences and trees. One key idea in dealing with compound data is the notion of closure—that the glue we use for combining data objects should allow us to combine not only primitive data objects, but compound data objects as well. Another key idea is that compound data objects can serve as conventional interfaces for combining program modules in mix-and-match ways. We illustrate some of these ideas by presenting a simple graphics language that exploits closure.

67 | 68 |

We will then augment the representational power of our language by introducing symbolic expressions—data whose elementary parts can be arbitrary symbols rather than only numbers. We explore various alternatives for representing sets of objects. We will find that, just as a given numerical function can be computed by many different computational processes, there are many ways in which a given data structure can be represented in terms of simpler objects, and the choice of representation can have significant impact on the time and space requirements of processes that manipulate the data. We will investigate these ideas in the context of symbolic differentiation, the representation of sets, and the encoding of information.

69 | 70 |

Next we will take up the problem of working with data that may be represented differently by different parts of a program. This leads to the need to implement generic operations, which must handle many different types of data. Maintaining modularity in the presence of generic operations requires more powerful abstraction barriers than can be erected with simple data abstraction alone. In particular, we introduce data-directed programming as a technique that allows individual data representations to be designed in isolation and then combined additively (i.e., without modification). To illustrate the power of this approach to system design, we close the chapter by applying what we have learned to the implementation of a package for performing symbolic arithmetic on polynomials, in which the coefficients of the polynomials can be integers, rational numbers, complex numbers, and even other polynomials.

71 | 72 |
73 |
74 |
75 | 76 |
77 |

1 The ability to directly manipulate procedures provides an analogous increase in the expressive power of a programming language. For example, in section 1.3.1 we introduced the sum procedure, which takes a procedure term as an argument and computes the sum of the values of term over some specified interval. In order to define sum, it is crucial that we be able to speak of a procedure such as term as an entity in its own right, without regard for how term might be expressed with more primitive operations. Indeed, if we did not have the notion of “a procedure,” it is doubtful that we would ever even think of the possibility of defining an operation such as sum. Moreover, insofar as performing the summation is concerned, the details of how term may be constructed from more primitive operations are irrelevant.

78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /content/book-Z-H-19.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 |

Chapter 3

24 | 25 |

Modularity, Objects, and State

26 |
27 | 28 |
29 | 30 | 31 | 52 | 53 |
32 |
33 | M 34 |
35 | 36 |
37 | (Even while it changes, it stands still.) 38 |
39 | 40 |
41 | Heraclitus 42 |
43 | 44 |
45 | Plus ça change, plus c’est la même chose. 46 |
47 | 48 |
49 | Alphonse Karr 50 |
51 |
54 |
55 | 56 |

The preceding chapters introduced the basic elements from which programs are made. We saw how primitive procedures and primitive data are combined to construct compound entities, and we learned that abstraction is vital in helping us to cope with the complexity of large systems. But these tools are not sufficient for designing programs. Effective program synthesis also requires organizational principles that can guide us in formulating the overall design of a program. In particular, we need strategies to help us structure large systems so that they will be modular, that is, so that they can be divided “naturally” into coherent parts that can be separately developed and maintained.

57 | 58 |

One powerful design strategy, which is particularly appropriate to the construction of programs for modeling physical systems, is to base the structure of our programs on the structure of the system being modeled. For each object in the system, we construct a corresponding computational object. For each system action, we define a symbolic operation in our computational model. Our hope in using this strategy is that extending the model to accommodate new objects or new actions will require no strategic changes to the program, only the addition of the new symbolic analogs of those objects or actions. If we have been successful in our system organization, then to add a new feature or debug an old one we will have to work on only a localized part of the system.

59 | 60 |

To a large extent, then, the way we organize a large program is dictated by our perception of the system to be modeled. In this chapter we will investigate two prominent organizational strategies arising from two rather different “world views” of the structure of systems. The first organizational strategy concentrates on objects, viewing a large system as a collection of distinct objects whose behaviors may change over time. An alternative organizational strategy concentrates on the streams of information that flow in the system, much as an electrical engineer views a signal-processing system.

61 | 62 |

Both the object-based approach and the stream-processing approach raise significant linguistic issues in programming. With objects, we must be concerned with how a computational object can change and yet maintain its identity. This will force us to abandon our old substitution model of computation (section 1.1.5) in favor of a more mechanistic but less theoretically tractable environment model of computation. The difficulties of dealing with objects, change, and identity are a fundamental consequence of the need to grapple with time in our computational models. These difficulties become even greater when we allow the possibility of concurrent execution of programs. The stream approach can be most fully exploited when we decouple simulated time in our model from the order of the events that take place in the computer during evaluation. We will accomplish this using a technique known as delayed evaluation.

63 | 64 | 65 | -------------------------------------------------------------------------------- /content/book-Z-H-2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 66 | 67 |
24 |

This book is one of a series of texts written by faculty of the Electrical Engineering and Computer Science Department at the Massachusetts Institute of Technology. It was edited and produced by The MIT Press under a joint production-distribution arrangement with the McGraw-Hill Book Company.

25 | 26 |

Ordering Information:

27 | 28 |

North America
29 | Text orders should be addressed to the McGraw-Hill Book Company.
30 | All other orders should be addressed to The MIT Press.

31 | 32 |

Outside North America
33 | All orders should be addressed to The MIT Press or its local distributor.

34 | 35 |

© 1996 by The Massachusetts Institute of Technology

36 | 37 |

Second edition

38 | 39 |

All rights reserved. No part of this book may be reproduced in any form or by any electronic or mechanical means (including photocopying, recording, or information storage and retrieval) without permission in writing from the publisher.

40 | 41 |

Creative Commons License
42 | This work is licensed under a Creative Commons Attribution-Noncommercial 3.0 Unported License.

43 | 44 |

This book was set by the authors using the LATEX typesetting system and was printed and bound in the United States of America.

45 | 46 |

Library of Congress Cataloging-in-Publication Data

47 | 48 |

Abelson, Harold
49 |     Structure and interpretation of computer programs / Harold Abelson
50 | and Gerald Jay Sussman, with Julie Sussman.—2nd ed.
51 |     p. cm.—(Electrical engineering and computer science
52 | series)
53 |     Includes bibliographical references and index.
54 |     ISBN 0-262-01153-0 (MIT Press hardcover)
55 |     ISBN 0-262-51087-1 (MIT Press paperback)
56 |     ISBN 0-07-000484-6 (McGraw-Hill hardcover)
57 |     1. Electronic digital computers—Programming. 2. LISP (Computer
58 | program language) I. Sussman, Gerald Jay. II. Sussman, Julie.
59 | III. Title. IV. Series: MIT electrical engineering and computer
60 | science series.
61 | QA76.6.A255         1996
62 | 005.13’3—dc20              96-17756
63 |
64 | Fourth printing, 1999

65 |
68 |
69 | 70 | 71 | -------------------------------------------------------------------------------- /content/book-Z-H-25.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 |

Chapter 4

24 | 25 |

Metalinguistic Abstraction

26 |
27 | 28 |
29 | 30 | 31 | 41 | 42 |
32 |
33 | It’s in words that the magic is—Abracadabra, Open Sesame, and the rest—but the magic words in one story aren’t magical in the next. The real magic is to understand which words work, and when, and for what; the trick is to learn the trick.
34 | And those words are made from the letters of our alphabet: a couple-dozen squiggles we can draw with the pen. This is the key! And the treasure, too, if we can only get our hands on it! It’s as if—as if the key to the treasure is the treasure!”
35 |
36 | 37 |
38 | John Barth, Chimera 39 |
40 |
43 |
44 | 45 |

In our study of program design, we have seen that expert programmers control the complexity of their designs with the same general techniques used by designers of all complex systems. They combine primitive elements to form compound objects, they abstract compound objects to form higher-level building blocks, and they preserve modularity by adopting appropriate large-scale views of system structure. In illustrating these techniques, we have used Lisp as a language for describing processes and for constructing computational data objects and processes to model complex phenomena in the real world. However, as we confront increasingly complex problems, we will find that Lisp, or indeed any fixed programming language, is not sufficient for our needs. We must constantly turn to new languages in order to express our ideas more effectively. Establishing new languages is a powerful strategy for controlling complexity in engineering design; we can often enhance our ability to deal with a complex problem by adopting a new language that enables us to describe (and hence to think about) the problem in a different way, using primitives, means of combination, and means of abstraction that are particularly well suited to the problem at hand.1

46 | 47 |

Programming is endowed with a multitude of languages. There are physical languages, such as the machine languages for particular computers. These languages are concerned with the representation of data and control in terms of individual bits of storage and primitive machine instructions. The machine-language programmer is concerned with using the given hardware to erect systems and utilities for the efficient implementation of resource-limited computations. High-level languages, erected on a machine-language substrate, hide concerns about the representation of data as collections of bits and the representation of programs as sequences of primitive instructions. These languages have means of combination and abstraction, such as procedure definition, that are appropriate to the larger-scale organization of systems.

48 | 49 |

Metalinguistic abstraction—establishing new languages—plays an important role in all branches of engineering design. It is particularly important to computer programming, because in programming not only can we formulate new languages but we can also implement these languages by constructing evaluators. An evaluator (or interpreter) for a programming language is a procedure that, when applied to an expression of the language, performs the actions required to evaluate that expression.

50 | 51 |

It is no exaggeration to regard this as the most fundamental idea in programming:

52 | 53 |
54 | The evaluator, which determines the meaning of expressions in a programming language, is just another program. 55 |
56 | 57 |

To appreciate this point is to change our images of ourselves as programmers. We come to see ourselves as designers of languages, rather than only users of languages designed by others.

58 | 59 |

In fact, we can regard almost any program as the evaluator for some language. For instance, the polynomial manipulation system of section 2.5.3 embodies the rules of polynomial arithmetic and implements them in terms of operations on list-structured data. If we augment this system with procedures to read and print polynomial expressions, we have the core of a special-purpose language for dealing with problems in symbolic mathematics. The digital-logic simulator of section 3.3.4 and the constraint propagator of section 3.3.5 are legitimate languages in their own right, each with its own primitives, means of combination, and means of abstraction. Seen from this perspective, the technology for coping with large-scale computer systems merges with the technology for building new computer languages, and computer science itself becomes no more (and no less) than the discipline of constructing appropriate descriptive languages.

60 | 61 |

We now embark on a tour of the technology by which languages are established in terms of other languages. In this chapter we shall use Lisp as a base, implementing evaluators as Lisp procedures. Lisp is particularly well suited to this task, because of its ability to represent and manipulate symbolic expressions. We will take the first step in understanding how languages are implemented by building an evaluator for Lisp itself. The language implemented by our evaluator will be a subset of the Scheme dialect of Lisp that we use in this book. Although the evaluator described in this chapter is written for a particular dialect of Lisp, it contains the essential structure of an evaluator for any expression-oriented language designed for writing programs for a sequential machine. (In fact, most language processors contain, deep within them, a little “Lisp” evaluator.) The evaluator has been simplified for the purposes of illustration and discussion, and some features have been left out that would be important to include in a production-quality Lisp system. Nevertheless, this simple evaluator is adequate to execute most of the programs in this book.2

62 | 63 |

An important advantage of making the evaluator accessible as a Lisp program is that we can implement alternative evaluation rules by describing these as modifications to the evaluator program. One place where we can use this power to good effect is to gain extra control over the ways in which computational models embody the notion of time, which was so central to the discussion in chapter 3. There, we mitigated some of the complexities of state and assignment by using streams to decouple the representation of time in the world from time in the computer. Our stream programs, however, were sometimes cumbersome, because they were constrained by the applicative-order evaluation of Scheme. In section 4.2, we’ll change the underlying language to provide for a more elegant approach, by modifying the evaluator to provide for normal-order evaluation.

64 | 65 |

Section 4.3 implements a more ambitious linguistic change, whereby expressions have many values, rather than just a single value. In this language of nondeterministic computing, it is natural to express processes that generate all possible values for expressions and then search for those values that satisfy certain constraints. In terms of models of computation and time, this is like having time branch into a set of “possible futures” and then searching for appropriate time lines. With our nondeterministic evaluator, keeping track of multiple values and performing searches are handled automatically by the underlying mechanism of the language.

66 | 67 |

In section 4.4 we implement a logic-programming language in which knowledge is expressed in terms of relations, rather than in terms of computations with inputs and outputs. Even though this makes the language drastically different from Lisp, or indeed from any conventional language, we will see that the logic-programming evaluator shares the essential structure of the Lisp evaluator.

68 | 69 |
70 |
71 |
72 | 73 |
74 |

1 The same idea is pervasive throughout all of engineering. For example, electrical engineers use many different languages for describing circuits. Two of these are the language of electrical networks and the language of electrical systems. The network language emphasizes the physical modeling of devices in terms of discrete electrical elements. The primitive objects of the network language are primitive electrical components such as resistors, capacitors, inductors, and transistors, which are characterized in terms of physical variables called voltage and current. When describing circuits in the network language, the engineer is concerned with the physical characteristics of a design. In contrast, the primitive objects of the system language are signal-processing modules such as filters and amplifiers. Only the functional behavior of the modules is relevant, and signals are manipulated without concern for their physical realization as voltages and currents. The system language is erected on the network language, in the sense that the elements of signal-processing systems are constructed from electrical networks. Here, however, the concerns are with the large-scale organization of electrical devices to solve a given application problem; the physical feasibility of the parts is assumed. This layered collection of languages is another example of the stratified design technique illustrated by the picture language of section 2.2.4.

75 | 76 |

2 The most important features that our evaluator leaves out are mechanisms for handling errors and supporting debugging. For a more extensive discussion of evaluators, see Friedman, Wand, and Haynes 1992, which gives an exposition of programming languages that proceeds via a sequence of evaluators written in Scheme.

77 |
78 | 79 | 80 | -------------------------------------------------------------------------------- /content/book-Z-H-3.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

This book is dedicated, in respect and admiration, to the spirit that lives in the computer.

21 | 22 |

“I think that it’s extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customers got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don’t think we are. I think we’re responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don’t become missionaries. Don’t feel as if you’re Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don’t feel as if the key to successful computing is only in your hands. What’s in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.”

23 | 24 |

Alan J. Perlis (April 1, 1922-February 7, 1990)

25 | 26 | 27 | -------------------------------------------------------------------------------- /content/book-Z-H-30.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 |

Chapter 5

24 | 25 |

Computing with Register Machines

26 |
27 | 28 |
29 | 30 | 31 | 40 | 41 |
32 |
33 | “My aim is to show that the heavenly machine is not a kind of divine, live being, but a kind of clockwork (and he who believes that a clock has soul attributes the maker’s glory to the work), insofar as nearly all the manifold motions are caused by a most simple and material force, just as all motions of the clock are caused by a single weight.” 34 |
35 | 36 |
37 | Johannes Kepler (letter to Herwart von Hohenburg, 1605) 38 |
39 |
42 |
43 | 44 |

We began this book by studying processes and by describing processes in terms of procedures written in Lisp. To explain the meanings of these procedures, we used a succession of models of evaluation: the substitution model of chapter 1, the environment model of chapter 3, and the metacircular evaluator of chapter 4. Our examination of the metacircular evaluator, in particular, dispelled much of the mystery of how Lisp-like languages are interpreted. But even the metacircular evaluator leaves important questions unanswered, because it fails to elucidate the mechanisms of control in a Lisp system. For instance, the evaluator does not explain how the evaluation of a subexpression manages to return a value to the expression that uses this value, nor does the evaluator explain how some recursive procedures generate iterative processes (that is, are evaluated using constant space) whereas other recursive procedures generate recursive processes. These questions remain unanswered because the metacircular evaluator is itself a Lisp program and hence inherits the control structure of the underlying Lisp system. In order to provide a more complete description of the control structure of the Lisp evaluator, we must work at a more primitive level than Lisp itself.

45 | 46 |

In this chapter we will describe processes in terms of the step-by-step operation of a traditional computer. Such a computer, or register machine, sequentially executes instructions that manipulate the contents of a fixed set of storage elements called registers. A typical register-machine instruction applies a primitive operation to the contents of some registers and assigns the result to another register. Our descriptions of processes executed by register machines will look very much like “machine-language” programs for traditional computers. However, instead of focusing on the machine language of any particular computer, we will examine several Lisp procedures and design a specific register machine to execute each procedure. Thus, we will approach our task from the perspective of a hardware architect rather than that of a machine-language computer programmer. In designing register machines, we will develop mechanisms for implementing important programming constructs such as recursion. We will also present a language for describing designs for register machines. In section 5.2 we will implement a Lisp program that uses these descriptions to simulate the machines we design.

47 | 48 |

Most of the primitive operations of our register machines are very simple. For example, an operation might add the numbers fetched from two registers, producing a result to be stored into a third register. Such an operation can be performed by easily described hardware. In order to deal with list structure, however, we will also use the memory operations car, cdr, and cons, which require an elaborate storage-allocation mechanism. In section 5.3 we study their implementation in terms of more elementary operations.

49 | 50 |

In section 5.4, after we have accumulated experience formulating simple procedures as register machines, we will design a machine that carries out the algorithm described by the metacircular evaluator of section 4.1. This will fill in the gap in our understanding of how Scheme expressions are interpreted, by providing an explicit model for the mechanisms of control in the evaluator. In section 5.5 we will study a simple compiler that translates Scheme programs into sequences of instructions that can be executed directly with the registers and operations of the evaluator register machine.

51 | 52 | 53 | -------------------------------------------------------------------------------- /content/book-Z-H-36.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
25 |

References

26 |
27 | 28 |
29 | Abelson, Harold, Andrew Berlin, Jacob Katzenelson, William McAllister, Guillermo Rozas, Gerald Jay Sussman, and Jack Wisdom. 1992. The Supercomputer Toolkit: A general framework for special-purpose computing. International Journal of High-Speed Electronics 3(3):337-361. 30 |
31 | 32 |
33 | Allen, John. 1978. Anatomy of Lisp. New York: McGraw-Hill. 34 |
35 | 36 |
37 | ANSI X3.226-1994. American National Standard for Information Systems—Programming Language—Common Lisp. 38 |
39 | 40 |
41 | Appel, Andrew W. 1987. Garbage collection can be faster than stack allocation. Information Processing Letters 25(4):275-279. 42 |
43 | 44 |
45 | Backus, John. 1978. Can programming be liberated from the von Neumann style? Communications of the ACM 21(8):613-641. 46 |
47 | 48 |
49 | Baker, Henry G., Jr. 1978. List processing in real time on a serial computer. Communications of the ACM 21(4):280-293. 50 |
51 | 52 |
53 | Batali, John, Neil Mayle, Howard Shrobe, Gerald Jay Sussman, and Daniel Weise. 1982. The Scheme-81 architecture—System and chip. In Proceedings of the MIT Conference on Advanced Research in VLSI, edited by Paul Penfield, Jr. Dedham, MA: Artech House. 54 |
55 | 56 |
57 | Borning, Alan. 1977. ThingLab—An object-oriented system for building simulations using constraints. In Proceedings of the 5th International Joint Conference on Artificial Intelligence. 58 |
59 | 60 |
61 | Borodin, Alan, and Ian Munro. 1975. The Computational Complexity of Algebraic and Numeric Problems. New York: American Elsevier. 62 |
63 | 64 |
65 | Chaitin, Gregory J. 1975. Randomness and mathematical proof. Scientific American 232(5):47-52. 66 |
67 | 68 |
69 | Church, Alonzo. 1941. The Calculi of Lambda-Conversion. Princeton, N.J.: Princeton University Press. 70 |
71 | 72 |
73 | Clark, Keith L. 1978. Negation as failure. In Logic and Data Bases. New York: Plenum Press, pp. 293-322. 74 |
75 | 76 |
77 | Clinger, William. 1982. Nondeterministic call by need is neither lazy nor by name. In Proceedings of the ACM Symposium on Lisp and Functional Programming, pp. 226-234. 78 |
79 | 80 |
81 | Clinger, William, and Jonathan Rees. 1991. Macros that work. In Proceedings of the 1991 ACM Conference on Principles of Programming Languages, pp. 155-162. 82 |
83 | 84 |
85 | Colmerauer A., H. Kanoui, R. Pasero, and P. Roussel. 1973. Un système de communication homme-machine en français. Technical report, Groupe Intelligence Artificielle, Université d’Aix Marseille, Luminy. 86 |
87 | 88 |
89 | Cormen, Thomas, Charles Leiserson, and Ronald Rivest. 1990. Introduction to Algorithms. Cambridge, MA: MIT Press. 90 |
91 | 92 |
93 | Darlington, John, Peter Henderson, and David Turner. 1982. Functional Programming and Its Applications. New York: Cambridge University Press. 94 |
95 | 96 |
97 | Dijkstra, Edsger W. 1968a. The structure of the “THE” multiprogramming system. Communications of the ACM 11(5):341-346. 98 |
99 | 100 |
101 | Dijkstra, Edsger W. 1968b. Cooperating sequential processes. In Programming Languages, edited by F. Genuys. New York: Academic Press, pp. 43-112. 102 |
103 | 104 |
105 | Dinesman, Howard P. 1968. Superior Mathematical Puzzles. New York: Simon and Schuster. 106 |
107 | 108 |
109 | deKleer, Johan, Jon Doyle, Guy Steele, and Gerald J. Sussman. 1977. AMORD: Explicit control of reasoning. In Proceedings of the ACM Symposium on Artificial Intelligence and Programming Languages, pp. 116-125. 110 |
111 | 112 |
113 | Doyle, Jon. 1979. A truth maintenance system. Artificial Intelligence 12:231-272. 114 |
115 | 116 |
117 | Feigenbaum, Edward, and Howard Shrobe. 1993. The Japanese National Fifth Generation Project: Introduction, survey, and evaluation. In Future Generation Computer Systems, vol. 9, pp. 105-117. 118 |
119 | 120 |
121 | Feeley, Marc. 1986. Deux approches à l’implantation du language Scheme. Masters thesis, Université de Montréal. 122 |
123 | 124 |
125 | Feeley, Marc and Guy Lapalme. 1987. Using closures for code generation. Journal of Computer Languages 12(1):47-66. 126 |
127 | 128 |
129 | Feller, William. 1957. An Introduction to Probability Theory and Its Applications, volume 1. New York: John Wiley & Sons. 130 |
131 | 132 |
133 | Fenichel, R., and J. Yochelson. 1969. A Lisp garbage collector for virtual memory computer systems. Communications of the ACM 12(11):611-612. 134 |
135 | 136 |
137 | Floyd, Robert. 1967. Nondeterministic algorithms. JACM, 14(4):636-644. 138 |
139 | 140 |
141 | Forbus, Kenneth D., and Johan deKleer. 1993. Building Problem Solvers. Cambridge, MA: MIT Press. 142 |
143 | 144 |
145 | Friedman, Daniel P., and David S. Wise. 1976. CONS should not evaluate its arguments. In Automata, Languages, and Programming: Third International Colloquium, edited by S. Michaelson and R. Milner, pp. 257-284. 146 |
147 | 148 |
149 | Friedman, Daniel P., Mitchell Wand, and Christopher T. Haynes. 1992. Essentials of Programming Languages. Cambridge, MA: MIT Press/McGraw-Hill. 150 |
151 | 152 |
153 | Gabriel, Richard P. 1988. The Why of Y. Lisp Pointers 2(2):15-25. 154 |
155 | 156 |
157 | Goldberg, Adele, and David Robson. 1983. Smalltalk-80: The Language and Its Implementation. Reading, MA: Addison-Wesley. 158 |
159 | 160 |
161 | Gordon, Michael, Robin Milner, and Christopher Wadsworth. 1979. Edinburgh LCF. Lecture Notes in Computer Science, volume 78. New York: Springer-Verlag. 162 |
163 | 164 |
165 | Gray, Jim, and Andreas Reuter. 1993. Transaction Processing: Concepts and Models. San Mateo, CA: Morgan-Kaufman. 166 |
167 | 168 |
169 | Green, Cordell. 1969. Application of theorem proving to problem solving. In Proceedings of the International Joint Conference on Artificial Intelligence, pp. 219-240. 170 |
171 | 172 |
173 | Green, Cordell, and Bertram Raphael. 1968. The use of theorem-proving techniques in question-answering systems. In Proceedings of the ACM National Conference, pp. 169-181. 174 |
175 | 176 |
177 | Griss, Martin L. 1981. Portable Standard Lisp, a brief overview. Utah Symbolic Computation Group Operating Note 58, University of Utah. 178 |
179 | 180 |
181 | Guttag, John V. 1977. Abstract data types and the development of data structures. Communications of the ACM 20(6):397-404. 182 |
183 | 184 |
185 | Hamming, Richard W. 1980. Coding and Information Theory. Englewood Cliffs, N.J.: Prentice-Hall. 186 |
187 | 188 |
189 | Hanson, Christopher P. 1990. Efficient stack allocation for tail-recursive languages. In Proceedings of ACM Conference on Lisp and Functional Programming, pp. 106-118. 190 |
191 | 192 |
193 | Hanson, Christopher P. 1991. A syntactic closures macro facility. Lisp Pointers, 4(3). 194 |
195 | 196 |
197 | Hardy, Godfrey H. 1921. Srinivasa Ramanujan. Proceedings of the London Mathematical Society XIX(2). 198 |
199 | 200 |
201 | Hardy, Godfrey H., and E. M. Wright. 1960. An Introduction to the Theory of Numbers. 4th edition. New York: Oxford University Press. 202 |
203 | 204 |
205 | Havender, J. 1968. Avoiding deadlocks in multi-tasking systems. IBM Systems Journal 7(2):74-84. 206 |
207 | 208 |
209 | Hearn, Anthony C. 1969. Standard Lisp. Technical report AIM-90, Artificial Intelligence Project, Stanford University. 210 |
211 | 212 |
213 | Henderson, Peter. 1980. Functional Programming: Application and Implementation. Englewood Cliffs, N.J.: Prentice-Hall. 214 |
215 | 216 |
217 | Henderson. Peter. 1982. Functional Geometry. In Conference Record of the 1982 ACM Symposium on Lisp and Functional Programming, pp. 179-187. 218 |
219 | 220 |
221 | Hewitt, Carl E. 1969. PLANNER: A language for proving theorems in robots. In Proceedings of the International Joint Conference on Artificial Intelligence, pp. 295-301. 222 |
223 | 224 |
225 | Hewitt, Carl E. 1977. Viewing control structures as patterns of passing messages. Journal of Artificial Intelligence 8(3):323-364. 226 |
227 | 228 |
229 | Hoare, C. A. R. 1972. Proof of correctness of data representations. Acta Informatica 1(1). 230 |
231 | 232 |
233 | Hodges, Andrew. 1983. Alan Turing: The Enigma. New York: Simon and Schuster. 234 |
235 | 236 |
237 | Hofstadter, Douglas R. 1979. Gödel, Escher, Bach: An Eternal Golden Braid. New York: Basic Books. 238 |
239 | 240 |
241 | Hughes, R. J. M. 1990. Why functional programming matters. In Research Topics in Functional Programming, edited by David Turner. Reading, MA: Addison-Wesley, pp. 17-42. 242 |
243 | 244 |
245 | IEEE Std 1178-1990. 1990. IEEE Standard for the Scheme Programming Language. 246 |
247 | 248 |
249 | Ingerman, Peter, Edgar Irons, Kirk Sattley, and Wallace Feurzeig; assisted by M. Lind, Herbert Kanner, and Robert Floyd. 1960. THUNKS: A way of compiling procedure statements, with some comments on procedure declarations. Unpublished manuscript. (Also, private communication from Wallace Feurzeig.) 250 |
251 | 252 |
253 | Kaldewaij, Anne. 1990. Programming: The Derivation of Algorithms. New York: Prentice-Hall. 254 |
255 | 256 |
257 | Kohlbecker, Eugene Edmund, Jr. 1986. Syntactic extensions in the programming language Lisp. Ph.D. thesis, Indiana University. 258 |
259 | 260 |
261 | Konopasek, Milos, and Sundaresan Jayaraman. 1984. The TK!Solver Book: A Guide to Problem-Solving in Science, Engineering, Business, and Education. Berkeley, CA: Osborne/McGraw-Hill. 262 |
263 | 264 |
265 | Knuth, Donald E. 1973. Fundamental Algorithms. Volume 1 of The Art of Computer Programming. 2nd edition. Reading, MA: Addison-Wesley. 266 |
267 | 268 |
269 | Knuth, Donald E. 1981. Seminumerical Algorithms. Volume 2 of The Art of Computer Programming. 2nd edition. Reading, MA: Addison-Wesley. 270 |
271 | 272 |
273 | Kowalski, Robert. 1973. Predicate logic as a programming language. Technical report 70, Department of Computational Logic, School of Artificial Intelligence, University of Edinburgh. 274 |
275 | 276 |
277 | Kowalski, Robert. 1979. Logic for Problem Solving. New York: North-Holland. 278 |
279 | 280 |
281 | Lamport, Leslie. 1978. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM 21(7):558-565. 282 |
283 | 284 |
285 | Lampson, Butler, J. J. Horning, R. London, J. G. Mitchell, and G. K. Popek. 1981. Report on the programming language Euclid. Technical report, Computer Systems Research Group, University of Toronto. 286 |
287 | 288 |
289 | Landin, Peter. 1965. A correspondence between Algol 60 and Church’s lambda notation: Part I. Communications of the ACM 8(2):89-101. 290 |
291 | 292 |
293 | Lieberman, Henry, and Carl E. Hewitt. 1983. A real-time garbage collector based on the lifetimes of objects. Communications of the ACM 26(6):419-429. 294 |
295 | 296 |
297 | Liskov, Barbara H., and Stephen N. Zilles. 1975. Specification techniques for data abstractions. IEEE Transactions on Software Engineering 1(1):7-19. 298 |
299 | 300 |
301 | McAllester, David Allen. 1978. A three-valued truth-maintenance system. Memo 473, MIT Artificial Intelligence Laboratory. 302 |
303 | 304 |
305 | McAllester, David Allen. 1980. An outlook on truth maintenance. Memo 551, MIT Artificial Intelligence Laboratory. 306 |
307 | 308 |
309 | McCarthy, John. 1960. Recursive functions of symbolic expressions and their computation by machine. Communications of the ACM 3(4):184-195. 310 |
311 | 312 |
313 | McCarthy, John. 1967. A basis for a mathematical theory of computation. In Computer Programing and Formal Systems, edited by P. Braffort and D. Hirschberg. North-Holland. 314 |
315 | 316 |
317 | McCarthy, John. 1978. The history of Lisp. In Proceedings of the ACM SIGPLAN Conference on the History of Programming Languages. 318 |
319 | 320 |
321 | McCarthy, John, P. W. Abrahams, D. J. Edwards, T. P. Hart, and M. I. Levin. 1965. Lisp 1.5 Programmer’s Manual. 2nd edition. Cambridge, MA: MIT Press. 322 |
323 | 324 |
325 | McDermott, Drew, and Gerald Jay Sussman. 1972. Conniver reference manual. Memo 259, MIT Artificial Intelligence Laboratory. 326 |
327 | 328 |
329 | Miller, Gary L. 1976. Riemann’s Hypothesis and tests for primality. Journal of Computer and System Sciences 13(3):300-317. 330 |
331 | 332 |
333 | Miller, James S., and Guillermo J. Rozas. 1994. Garbage collection is fast, but a stack is faster. Memo 1462, MIT Artificial Intelligence Laboratory. 334 |
335 | 336 |
337 | Moon, David. 1978. MacLisp reference manual, Version 0. Technical report, MIT Laboratory for Computer Science. 338 |
339 | 340 |
341 | Moon, David, and Daniel Weinreb. 1981. Lisp machine manual. Technical report, MIT Artificial Intelligence Laboratory. 342 |
343 | 344 |
345 | Morris, J. H., Eric Schmidt, and Philip Wadler. 1980. Experience with an applicative string processing language. In Proceedings of the 7th Annual ACM SIGACT/SIGPLAN Symposium on the Principles of Programming Languages. 346 |
347 | 348 |
349 | Phillips, Hubert. 1934. The Sphinx Problem Book. London: Faber and Faber. 350 |
351 | 352 |
353 | Pitman, Kent. 1983. The revised MacLisp Manual (Saturday evening edition). Technical report 295, MIT Laboratory for Computer Science. 354 |
355 | 356 |
357 | Rabin, Michael O. 1980. Probabilistic algorithm for testing primality. Journal of Number Theory 12:128-138. 358 |
359 | 360 |
361 | Raymond, Eric. 1993. The New Hacker’s Dictionary. 2nd edition. Cambridge, MA: MIT Press. 362 |
363 | 364 |
365 | Raynal, Michel. 1986. Algorithms for Mutual Exclusion. Cambridge, MA: MIT Press. 366 |
367 | 368 |
369 | Rees, Jonathan A., and Norman I. Adams IV. 1982. T: A dialect of Lisp or, lambda: The ultimate software tool. In Conference Record of the 1982 ACM Symposium on Lisp and Functional Programming, pp. 114-122. 370 |
371 | 372 |
373 | Rees, Jonathan, and William Clinger (eds). 1991. The revised4 report on the algorithmic language Scheme. Lisp Pointers, 4(3). 374 |
375 | 376 |
377 | Rivest, Ronald, Adi Shamir, and Leonard Adleman. 1977. A method for obtaining digital signatures and public-key cryptosystems. Technical memo LCS/TM82, MIT Laboratory for Computer Science. 378 |
379 | 380 |
381 | Robinson, J. A. 1965. A machine-oriented logic based on the resolution principle. Journal of the ACM 12(1):23. 382 |
383 | 384 |
385 | Robinson, J. A. 1983. Logic programming—Past, present, and future. New Generation Computing 1:107-124. 386 |
387 | 388 |
389 | Spafford, Eugene H. 1989. The Internet Worm: Crisis and aftermath. Communications of the ACM 32(6):678-688. 390 |
391 | 392 |
393 | Steele, Guy Lewis, Jr. 1977. Debunking the “expensive procedure call” myth. In Proceedings of the National Conference of the ACM, pp. 153-62. 394 |
395 | 396 |
397 | Steele, Guy Lewis, Jr. 1982. An overview of Common Lisp. In Proceedings of the ACM Symposium on Lisp and Functional Programming, pp. 98-107. 398 |
399 | 400 |
401 | Steele, Guy Lewis, Jr. 1990. Common Lisp: The Language. 2nd edition. Digital Press. 402 |
403 | 404 |
405 | Steele, Guy Lewis, Jr., and Gerald Jay Sussman. 1975. Scheme: An interpreter for the extended lambda calculus. Memo 349, MIT Artificial Intelligence Laboratory. 406 |
407 | 408 |
409 | Steele, Guy Lewis, Jr., Donald R. Woods, Raphael A. Finkel, Mark R. Crispin, Richard M. Stallman, and Geoffrey S. Goodfellow. 1983. The Hacker’s Dictionary. New York: Harper & Row. 410 |
411 | 412 |
413 | Stoy, Joseph E. 1977. Denotational Semantics. Cambridge, MA: MIT Press. 414 |
415 | 416 |
417 | Sussman, Gerald Jay, and Richard M. Stallman. 1975. Heuristic techniques in computer-aided circuit analysis. IEEE Transactions on Circuits and Systems CAS-22(11):857-865. 418 |
419 | 420 |
421 | Sussman, Gerald Jay, and Guy Lewis Steele Jr. 1980. Constraints—A language for expressing almost-hierachical descriptions. AI Journal 14:1-39. 422 |
423 | 424 |
425 | Sussman, Gerald Jay, and Jack Wisdom. 1992. Chaotic evolution of the solar system. Science 257:256-262. 426 |
427 | 428 |
429 | Sussman, Gerald Jay, Terry Winograd, and Eugene Charniak. 1971. Microplanner reference manual. Memo 203A, MIT Artificial Intelligence Laboratory. 430 |
431 | 432 |
433 | Sutherland, Ivan E. 1963. SKETCHPAD: A man-machine graphical communication system. Technical report 296, MIT Lincoln Laboratory. 434 |
435 | 436 |
437 | Teitelman, Warren. 1974. Interlisp reference manual. Technical report, Xerox Palo Alto Research Center. 438 |
439 | 440 |
441 | Thatcher, James W., Eric G. Wagner, and Jesse B. Wright. 1978. Data type specification: Parameterization and the power of specification techniques. In Conference Record of the Tenth Annual ACM Symposium on Theory of Computing, pp. 119-132. Turner, David. 1981. The future of applicative languages. In Proceedings of the 3rd European Conference on Informatics, Lecture Notes in Computer Science, volume 123. New York: Springer-Verlag, pp. 334-348. 442 |
443 | 444 |
445 | Wand, Mitchell. 1980. Continuation-based program transformation strategies. Journal of the ACM 27(1):164-180. 446 |
447 | 448 |
449 | Waters, Richard C. 1979. A method for analyzing loop programs. IEEE Transactions on Software Engineering 5(3):237-247. 450 |
451 | 452 |
453 | Winograd, Terry. 1971. Procedures as a representation for data in a computer program for understanding natural language. Technical report AI TR-17, MIT Artificial Intelligence Laboratory. 454 |
455 | 456 |
457 | Winston, Patrick. 1992. Artificial Intelligence. 3rd edition. Reading, MA: Addison-Wesley. 458 |
459 | 460 |
461 | Zabih, Ramin, David McAllester, and David Chapman. 1987. Non-deterministic Lisp with dependency-directed backtracking. AAAI-87, pp. 59-64. 462 |
463 | 464 |
465 | Zippel, Richard. 1979. Probabilistic algorithms for sparse polynomials. Ph.D. dissertation, Department of Electrical Engineering and Computer Science, MIT. 466 |
467 | 468 |
469 | Zippel, Richard. 1993. Effective Polynomial Computation. Boston, MA: Kluwer Academic Publishers. 470 |
471 | 472 | 473 | -------------------------------------------------------------------------------- /content/book-Z-H-37.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 |

List of Exercises

24 |
25 | 26 | 29 | 30 | 33 | 34 | 37 | 38 | 41 | 42 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /content/book-Z-H-4.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 |

19 |

20 | 21 |
22 |

Contents

23 |
24 | 25 |

26 | 27 |
28 | Foreword 29 |
30 | 31 | 34 | 35 | 38 | 39 |
40 | Acknowledgments 41 |
42 |
43 | 44 |

1  Building Abstractions with Procedures

45 | 46 |

1.1  The Elements of Programming

47 | 48 |

1.1.1  Expressions

49 | 50 |

1.1.2  Naming and the Environment

51 | 52 |

1.1.3  Evaluating Combinations

53 | 54 |

1.1.4  Compound Procedures

55 | 56 |

1.1.5  The Substitution Model for Procedure Application

57 | 58 |

1.1.6  Conditional Expressions and Predicates

59 | 60 |

1.1.7  Example: Square Roots by Newton’s Method

61 | 62 |

1.1.8  Procedures as Black-Box Abstractions

63 | 64 |

1.2  Procedures and the Processes They Generate

65 | 66 |

1.2.1  Linear Recursion and Iteration

67 | 68 |

1.2.2  Tree Recursion

69 | 70 |

1.2.3  Orders of Growth

71 | 72 |

1.2.4  Exponentiation

73 | 74 |

1.2.5  Greatest Common Divisors

75 | 76 |

1.2.6  Example: Testing for Primality

77 | 78 |

1.3  Formulating Abstractions with Higher-Order Procedures

79 | 80 |

1.3.1  Procedures as Arguments

81 | 82 |

1.3.2  Constructing Procedures Using Lambda

83 | 84 |

1.3.3  Procedures as General Methods

85 | 86 |

1.3.4  Procedures as Returned Values

87 | 88 | 89 | 90 |

2  Building Abstractions with Data

91 | 92 |

2.1  Introduction to Data Abstraction

93 | 94 |

2.1.1  Example: Arithmetic Operations for Rational Numbers

95 | 96 |

2.1.2  Abstraction Barriers

97 | 98 |

2.1.3  What Is Meant by Data?

99 | 100 |

2.1.4  Extended Exercise: Interval Arithmetic

101 | 102 |

2.2  Hierarchical Data and the Closure Property

103 | 104 |

2.2.1  Representing Sequences

105 | 106 |

2.2.2  Hierarchical Structures

107 | 108 |

2.2.3  Sequences as Conventional Interfaces

109 | 110 |

2.2.4  Example: A Picture Language

111 | 112 |

2.3  Symbolic Data

113 | 114 |

2.3.1  Quotation

115 | 116 |

2.3.2  Example: Symbolic Differentiation

117 | 118 |

2.3.3  Example: Representing Sets

119 | 120 |

2.3.4  Example: Huffman Encoding Trees

121 | 122 |

2.4  Multiple Representations for Abstract Data

123 | 124 |

2.4.1  Representations for Complex Numbers

125 | 126 |

2.4.2  Tagged data

127 | 128 |

2.4.3  Data-Directed Programming and Additivity

129 | 130 |

2.5  Systems with Generic Operations

131 | 132 |

2.5.1  Generic Arithmetic Operations

133 | 134 |

2.5.2  Combining Data of Different Types

135 | 136 |

2.5.3  Example: Symbolic Algebra

137 | 138 | 139 | 140 |

3  Modularity, Objects, and State

141 | 142 |

3.1  Assignment and Local State

143 | 144 |

3.1.1  Local State Variables

145 | 146 |

3.1.2  The Benefits of Introducing Assignment

147 | 148 |

3.1.3  The Costs of Introducing Assignment

149 | 150 |

3.2  The Environment Model of Evaluation

151 | 152 |

3.2.1  The Rules for Evaluation

153 | 154 |

3.2.2  Applying Simple Procedures

155 | 156 |

3.2.3  Frames as the Repository of Local State

157 | 158 |

3.2.4  Internal Definitions

159 | 160 |

3.3  Modeling with Mutable Data

161 | 162 |

3.3.1  Mutable List Structure

163 | 164 |

3.3.2  Representing Queues

165 | 166 |

3.3.3  Representing Tables

167 | 168 |

3.3.4  A Simulator for Digital Circuits

169 | 170 |

3.3.5  Propagation of Constraints

171 | 172 |

3.4  Concurrency: Time Is of the Essence

173 | 174 |

3.4.1  The Nature of Time in Concurrent Systems

175 | 176 |

3.4.2  Mechanisms for Controlling Concurrency

177 | 178 |

3.5  Streams

179 | 180 |

3.5.1  Streams Are Delayed Lists

181 | 182 |

3.5.2  Infinite Streams

183 | 184 |

3.5.3  Exploiting the Stream Paradigm

185 | 186 |

3.5.4  Streams and Delayed Evaluation

187 | 188 |

3.5.5  Modularity of Functional Programs and Modularity of Objects

189 | 190 | 191 | 192 |

4  Metalinguistic Abstraction

193 | 194 |

4.1  The Metacircular Evaluator

195 | 196 |

4.1.1  The Core of the Evaluator

197 | 198 |

4.1.2  Representing Expressions

199 | 200 |

4.1.3  Evaluator Data Structures

201 | 202 |

4.1.4  Running the Evaluator as a Program

203 | 204 |

4.1.5  Data as Programs

205 | 206 |

4.1.6  Internal Definitions

207 | 208 |

4.1.7  Separating Syntactic Analysis from Execution

209 | 210 |

4.2  Variations on a Scheme—Lazy Evaluation

211 | 212 |

4.2.1  Normal Order and Applicative Order

213 | 214 |

4.2.2  An Interpreter with Lazy Evaluation

215 | 216 |

4.2.3  Streams as Lazy Lists

217 | 218 |

4.3  Variations on a Scheme—Nondeterministic Computing

219 | 220 |

4.3.1  Amb and Search

221 | 222 |

4.3.2  Examples of Nondeterministic Programs

223 | 224 |

4.3.3  Implementing the Amb Evaluator

225 | 226 |

4.4  Logic Programming

227 | 228 |

4.4.1  Deductive Information Retrieval

229 | 230 |

4.4.2  How the Query System Works

231 | 232 |

4.4.3  Is Logic Programming Mathematical Logic?

233 | 234 |

4.4.4  Implementing the Query System

235 | 236 | 237 | 238 |

5  Computing with Register Machines

239 | 240 |

5.1  Designing Register Machines

241 | 242 |

5.1.1  A Language for Describing Register Machines

243 | 244 |

5.1.2  Abstraction in Machine Design

245 | 246 |

5.1.3  Subroutines

247 | 248 |

5.1.4  Using a Stack to Implement Recursion

249 | 250 |

5.1.5  Instruction Summary

251 | 252 |

5.2  A Register-Machine Simulator

253 | 254 |

5.2.1  The Machine Model

255 | 256 |

5.2.2  The Assembler

257 | 258 |

5.2.3  Generating Execution Procedures for Instructions

259 | 260 |

5.2.4  Monitoring Machine Performance

261 | 262 |

5.3  Storage Allocation and Garbage Collection

263 | 264 |

5.3.1  Memory as Vectors

265 | 266 |

5.3.2  Maintaining the Illusion of Infinite Memory

267 | 268 |

5.4  The Explicit-Control Evaluator

269 | 270 |

5.4.1  The Core of the Explicit-Control Evaluator

271 | 272 |

5.4.2  Sequence Evaluation and Tail Recursion

273 | 274 |

5.4.3  Conditionals, Assignments, and Definitions

275 | 276 |

5.4.4  Running the Evaluator

277 | 278 |

5.5  Compilation

279 | 280 |

5.5.1  Structure of the Compiler

281 | 282 |

5.5.2  Compiling Expressions

283 | 284 |

5.5.3  Compiling Combinations

285 | 286 |

5.5.4  Combining Instruction Sequences

287 | 288 |

5.5.5  An Example of Compiled Code

289 | 290 |

5.5.6  Lexical Addressing

291 | 292 |

5.5.7  Interfacing Compiled Code to the Evaluator

293 |
294 | 295 |
296 | References 297 |
298 | 299 |
300 | List of Exercises 301 |
302 | 303 |
304 | Index 305 |
306 | 307 | 308 | -------------------------------------------------------------------------------- /content/book-Z-H-5.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 |

Foreword

24 |
25 | 26 |

Educators, generals, dieticians, psychologists, and parents program. Armies, students, and some societies are programmed. An assault on large problems employs a succession of programs, most of which spring into existence en route. These programs are rife with issues that appear to be particular to the problem at hand. To appreciate programming as an intellectual activity in its own right you must turn to computer programming; you must read and write computer programs—many of them. It doesn’t matter much what the programs are about or what applications they serve. What does matter is how well they perform and how smoothly they fit with other programs in the creation of still greater programs. The programmer must seek both perfection of part and adequacy of collection. In this book the use of “program” is focused on the creation, execution, and study of programs written in a dialect of Lisp for execution on a digital computer. Using Lisp we restrict or limit not what we may program, but only the notation for our program descriptions.

27 | 28 |

Our traffic with the subject matter of this book involves us with three foci of phenomena: the human mind, collections of computer programs, and the computer. Every computer program is a model, hatched in the mind, of a real or mental process. These processes, arising from human experience and thought, are huge in number, intricate in detail, and at any time only partially understood. They are modeled to our permanent satisfaction rarely by our computer programs. Thus even though our programs are carefully handcrafted discrete collections of symbols, mosaics of interlocking functions, they continually evolve: we change them as our perception of the model deepens, enlarges, generalizes until the model ultimately attains a metastable place within still another model with which we struggle. The source of the exhilaration associated with computer programming is the continual unfolding within the mind and on the computer of mechanisms expressed as programs and the explosion of perception they generate. If art interprets our dreams, the computer executes them in the guise of programs!

29 | 30 |

For all its power, the computer is a harsh taskmaster. Its programs must be correct, and what we wish to say must be said accurately in every detail. As in every other symbolic activity, we become convinced of program truth through argument. Lisp itself can be assigned a semantics (another model, by the way), and if a program’s function can be specified, say, in the predicate calculus, the proof methods of logic can be used to make an acceptable correctness argument. Unfortunately, as programs get large and complicated, as they almost always do, the adequacy, consistency, and correctness of the specifications themselves become open to doubt, so that complete formal arguments of correctness seldom accompany large programs. Since large programs grow from small ones, it is crucial that we develop an arsenal of standard program structures of whose correctness we have become sure—we call them idioms—and learn to combine them into larger structures using organizational techniques of proven value. These techniques are treated at length in this book, and understanding them is essential to participation in the Promethean enterprise called programming. More than anything else, the uncovering and mastery of powerful organizational techniques accelerates our ability to create large, significant programs. Conversely, since writing large programs is very taxing, we are stimulated to invent new methods of reducing the mass of function and detail to be fitted into large programs.

31 | 32 |

Unlike programs, computers must obey the laws of physics. If they wish to perform rapidly—a few nanoseconds per state change—they must transmit electrons only small distances (at most 1 1/2 feet). The heat generated by the huge number of devices so concentrated in space has to be removed. An exquisite engineering art has been developed balancing between multiplicity of function and density of devices. In any event, hardware always operates at a level more primitive than that at which we care to program. The processes that transform our Lisp programs to “machine” programs are themselves abstract models which we program. Their study and creation give a great deal of insight into the organizational programs associated with programming arbitrary models. Of course the computer itself can be so modeled. Think of it: the behavior of the smallest physical switching element is modeled by quantum mechanics described by differential equations whose detailed behavior is captured by numerical approximations represented in computer programs executing on computers composed of !

33 | 34 |

It is not merely a matter of tactical convenience to separately identify the three foci. Even though, as they say, it’s all in the head, this logical separation induces an acceleration of symbolic traffic between these foci whose richness, vitality, and potential is exceeded in human experience only by the evolution of life itself. At best, relationships between the foci are metastable. The computers are never large enough or fast enough. Each breakthrough in hardware technology leads to more massive programming enterprises, new organizational principles, and an enrichment of abstract models. Every reader should ask himself periodically “Toward what end, toward what end?”—but do not ask it too often lest you pass up the fun of programming for the constipation of bittersweet philosophy.

35 | 36 |

Among the programs we write, some (but never enough) perform a precise mathematical function such as sorting or finding the maximum of a sequence of numbers, determining primality, or finding the square root. We call such programs algorithms, and a great deal is known of their optimal behavior, particularly with respect to the two important parameters of execution time and data storage requirements. A programmer should acquire good algorithms and idioms. Even though some programs resist precise specifications, it is the responsibility of the programmer to estimate, and always to attempt to improve, their performance.

37 | 38 |

Lisp is a survivor, having been in use for about a quarter of a century. Among the active programming languages only Fortran has had a longer life. Both languages have supported the programming needs of important areas of application, Fortran for scientific and engineering computation and Lisp for artificial intelligence. These two areas continue to be important, and their programmers are so devoted to these two languages that Lisp and Fortran may well continue in active use for at least another quarter-century.

39 | 40 |

Lisp changes. The Scheme dialect used in this text has evolved from the original Lisp and differs from the latter in several important ways, including static scoping for variable binding and permitting functions to yield functions as values. In its semantic structure Scheme is as closely akin to Algol 60 as to early Lisps. Algol 60, never to be an active language again, lives on in the genes of Scheme and Pascal. It would be difficult to find two languages that are the communicating coin of two more different cultures than those gathered around these two languages. Pascal is for building pyramids—imposing, breathtaking, static structures built by armies pushing heavy blocks into place. Lisp is for building organisms—imposing, breathtaking, dynamic structures built by squads fitting fluctuating myriads of simpler organisms into place. The organizing principles used are the same in both cases, except for one extraordinarily important difference: The discretionary exportable functionality entrusted to the individual Lisp programmer is more than an order of magnitude greater than that to be found within Pascal enterprises. Lisp programs inflate libraries with functions whose utility transcends the application that produced them. The list, Lisp’s native data structure, is largely responsible for such growth of utility. The simple structure and natural applicability of lists are reflected in functions that are amazingly nonidiosyncratic. In Pascal the plethora of declarable data structures induces a specialization within functions that inhibits and penalizes casual cooperation. It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures. As a result the pyramid must stand unchanged for a millennium; the organism must evolve or perish.

41 | 42 |

To illustrate this difference, compare the treatment of material and exercises within this book with that in any first-course text using Pascal. Do not labor under the illusion that this is a text digestible at MIT only, peculiar to the breed found there. It is precisely what a serious book on programming Lisp must be, no matter who the student is or where it is used.

43 | 44 |

Note that this is a text about programming, unlike most Lisp books, which are used as a preparation for work in artificial intelligence. After all, the critical programming concerns of software engineering and artificial intelligence tend to coalesce as the systems under investigation become larger. This explains why there is such growing interest in Lisp outside of artificial intelligence.

45 | 46 |

As one would expect from its goals, artificial intelligence research generates many significant programming problems. In other programming cultures this spate of problems spawns new languages. Indeed, in any very large programming task a useful organizing principle is to control and isolate traffic within the task modules via the invention of language. These languages tend to become less primitive as one approaches the boundaries of the system where we humans interact most often. As a result, such systems contain complex language-processing functions replicated many times. Lisp has such a simple syntax and semantics that parsing can be treated as an elementary task. Thus parsing technology plays almost no role in Lisp programs, and the construction of language processors is rarely an impediment to the rate of growth and change of large Lisp systems. Finally, it is this very simplicity of syntax and semantics that is responsible for the burden and freedom borne by all Lisp programmers. No Lisp program of any size beyond a few lines can be written without being saturated with discretionary functions. Invent and fit; have fits and reinvent! We toast the Lisp programmer who pens his thoughts within nests of parentheses.

47 | 48 |
49 | 50 | 51 | 53 | 54 |
Alan J. Perlis
52 | New Haven, Connecticut
55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /content/book-Z-H-6.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 25 | 26 |
27 | 28 | 29 | 38 | 39 |
30 |
31 | “Is it possible that software is not like anything else, that it is meant to be discarded: that the whole point is to always see it as a soap bubble?” 32 |
33 | 34 |
35 | Alan J. Perlis 36 |
37 |
40 |
41 | 42 |

The material in this book has been the basis of MIT’s entry-level computer science subject since 1980. We had been teaching this material for four years when the first edition was published, and twelve more years have elapsed until the appearance of this second edition. We are pleased that our work has been widely adopted and incorporated into other texts. We have seen our students take the ideas and programs in this book and build them in as the core of new computer systems and languages. In literal realization of an ancient Talmudic pun, our students have become our builders. We are lucky to have such capable students and such accomplished builders.

43 | 44 |

In preparing this edition, we have incorporated hundreds of clarifications suggested by our own teaching experience and the comments of colleagues at MIT and elsewhere. We have redesigned most of the major programming systems in the book, including the generic-arithmetic system, the interpreters, the register-machine simulator, and the compiler; and we have rewritten all the program examples to ensure that any Scheme implementation conforming to the IEEE Scheme standard (IEEE 1990) will be able to run the code.

45 | 46 |

This edition emphasizes several new themes. The most important of these is the central role played by different approaches to dealing with time in computational models: objects with state, concurrent programming, functional programming, lazy evaluation, and nondeterministic programming. We have included new sections on concurrency and nondeterminism, and we have tried to integrate this theme throughout the book.

47 | 48 |

The first edition of the book closely followed the syllabus of our MIT one-semester subject. With all the new material in the second edition, it will not be possible to cover everything in a single semester, so the instructor will have to pick and choose. In our own teaching, we sometimes skip the section on logic programming (section 4.4), we have students use the register-machine simulator but we do not cover its implementation (section 5.2), and we give only a cursory overview of the compiler (section 5.5). Even so, this is still an intense course. Some instructors may wish to cover only the first three or four chapters, leaving the other material for subsequent courses.

49 | 50 |

The World-Wide-Web site www-mitpress.mit.edu/sicp provides support for users of this book. This includes programs from the book, sample programming assignments, supplementary materials, and downloadable implementations of the Scheme dialect of Lisp.

51 | 52 | 53 | -------------------------------------------------------------------------------- /content/book-Z-H-7.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 25 | 26 |
27 | 28 | 29 | 39 | 40 |
30 |
31 | “A computer is like a violin. You can imagine a novice trying first a phonograph and then a violin. The latter, he says, sounds terrible. That is the argument we have heard from our humanists and most of our computer scientists. Computer programs are good, they say, for particular purposes, but they aren’t flexible. Neither is a violin, or a typewriter, until you learn how to use it.” 32 |
33 | 34 |
35 | Marvin Minsky, “Why Programming Is a Good
36 | Medium for Expressing Poorly-Understood and Sloppily-Formulated Ideas”
37 |
38 |
41 |
42 | 43 |

“The Structure and Interpretation of Computer Programs” is the entry-level subject in computer science at the Massachusetts Institute of Technology. It is required of all students at MIT who major in electrical engineering or in computer science, as one-fourth of the “common core curriculum,” which also includes two subjects on circuits and linear systems and a subject on the design of digital systems. We have been involved in the development of this subject since 1978, and we have taught this material in its present form since the fall of 1980 to between 600 and 700 students each year. Most of these students have had little or no prior formal training in computation, although many have played with computers a bit and a few have had extensive programming or hardware-design experience.

44 | 45 |

Our design of this introductory computer-science subject reflects two major concerns. First, we want to establish the idea that a computer language is not just a way of getting a computer to perform operations but rather that it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute. Second, we believe that the essential material to be addressed by a subject at this level is not the syntax of particular programming-language constructs, nor clever algorithms for computing particular functions efficiently, nor even the mathematical analysis of algorithms and the foundations of computing, but rather the techniques used to control the intellectual complexity of large software systems.

46 | 47 |

Our goal is that students who complete this subject should have a good feel for the elements of style and the aesthetics of programming. They should have command of the major techniques for controlling complexity in a large system. They should be capable of reading a 50-page-long program, if it is written in an exemplary style. They should know what not to read, and what they need not understand at any moment. They should feel secure about modifying a program, retaining the spirit and style of the original author.

48 | 49 |

These skills are by no means unique to computer programming. The techniques we teach and draw upon are common to all of engineering design. We control complexity by building abstractions that hide details when appropriate. We control complexity by establishing conventional interfaces that enable us to construct systems by combining standard, well-understood pieces in a “mix and match” way. We control complexity by establishing new languages for describing a design, each of which emphasizes particular aspects of the design and deemphasizes others.

50 | 51 |

Underlying our approach to this subject is our conviction that “computer science” is not a science and that its significance has little to do with computers. The computer revolution is a revolution in the way we think and in the way we express what we think. The essence of this change is the emergence of what might best be called procedural epistemology—the study of the structure of knowledge from an imperative point of view, as opposed to the more declarative point of view taken by classical mathematical subjects. Mathematics provides a framework for dealing precisely with notions of “what is.” Computation provides a framework for dealing precisely with notions of “how to.”

52 | 53 |

In teaching our material we use a dialect of the programming language Lisp. We never formally teach the language, because we don’t have to. We just use it, and students pick it up in a few days. This is one great advantage of Lisp-like languages: They have very few ways of forming compound expressions, and almost no syntactic structure. All of the formal properties can be covered in an hour, like the rules of chess. After a short time we forget about syntactic details of the language (because there are none) and get on with the real issues—figuring out what we want to compute, how we will decompose problems into manageable parts, and how we will work on the parts. Another advantage of Lisp is that it supports (but does not enforce) more of the large-scale strategies for modular decomposition of programs than any other language we know. We can make procedural and data abstractions, we can use higher-order functions to capture common patterns of usage, we can model local state using assignment and data mutation, we can link parts of a program with streams and delayed evaluation, and we can easily implement embedded languages. All of this is embedded in an interactive environment with excellent support for incremental program design, construction, testing, and debugging. We thank all the generations of Lisp wizards, starting with John McCarthy, who have fashioned a fine tool of unprecedented power and elegance.

54 | 55 |

Scheme, the dialect of Lisp that we use, is an attempt to bring together the power and elegance of Lisp and Algol. From Lisp we take the metalinguistic power that derives from the simple syntax, the uniform representation of programs as data objects, and the garbage-collected heap-allocated data. From Algol we take lexical scoping and block structure, which are gifts from the pioneers of programming-language design who were on the Algol committee. We wish to cite John Reynolds and Peter Landin for their insights into the relationship of Church’s lambda calculus to the structure of programming languages. We also recognize our debt to the mathematicians who scouted out this territory decades before computers appeared on the scene. These pioneers include Alonzo Church, Barkley Rosser, Stephen Kleene, and Haskell Curry.

56 | 57 | 58 | -------------------------------------------------------------------------------- /content/book-Z-H-8.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 |
23 |

Acknowledgments

24 |
25 | 26 |

We would like to thank the many people who have helped us develop this book and this curriculum.

27 | 28 |

Our subject is a clear intellectual descendant of “6.231,” a wonderful subject on programming linguistics and the lambda calculus taught at MIT in the late 1960s by Jack Wozencraft and Arthur Evans, Jr.

29 | 30 |

We owe a great debt to Robert Fano, who reorganized MIT’s introductory curriculum in electrical engineering and computer science to emphasize the principles of engineering design. He led us in starting out on this enterprise and wrote the first set of subject notes from which this book evolved.

31 | 32 |

Much of the style and aesthetics of programming that we try to teach were developed in conjunction with Guy Lewis Steele Jr., who collaborated with Gerald Jay Sussman in the initial development of the Scheme language. In addition, David Turner, Peter Henderson, Dan Friedman, David Wise, and Will Clinger have taught us many of the techniques of the functional programming community that appear in this book.

33 | 34 |

Joel Moses taught us about structuring large systems. His experience with the Macsyma system for symbolic computation provided the insight that one should avoid complexities of control and concentrate on organizing the data to reflect the real structure of the world being modeled.

35 | 36 |

Marvin Minsky and Seymour Papert formed many of our attitudes about programming and its place in our intellectual lives. To them we owe the understanding that computation provides a means of expression for exploring ideas that would otherwise be too complex to deal with precisely. They emphasize that a student’s ability to write and modify programs provides a powerful medium in which exploring becomes a natural activity.

37 | 38 |

We also strongly agree with Alan Perlis that programming is lots of fun and we had better be careful to support the joy of programming. Part of this joy derives from observing great masters at work. We are fortunate to have been apprentice programmers at the feet of Bill Gosper and Richard Greenblatt.

39 | 40 |

It is difficult to identify all the people who have contributed to the development of our curriculum. We thank all the lecturers, recitation instructors, and tutors who have worked with us over the past fifteen years and put in many extra hours on our subject, especially Bill Siebert, Albert Meyer, Joe Stoy, Randy Davis, Louis Braida, Eric Grimson, Rod Brooks, Lynn Stein, and Peter Szolovits. We would like to specially acknowledge the outstanding teaching contributions of Franklyn Turbak, now at Wellesley; his work in undergraduate instruction set a standard that we can all aspire to. We are grateful to Jerry Saltzer and Jim Miller for helping us grapple with the mysteries of concurrency, and to Peter Szolovits and David McAllester for their contributions to the exposition of nondeterministic evaluation in chapter 4.

41 | 42 |

Many people have put in significant effort presenting this material at other universities. Some of the people we have worked closely with are Jacob Katzenelson at the Technion, Hardy Mayer at the University of California at Irvine, Joe Stoy at Oxford, Elisha Sacks at Purdue, and Jan Komorowski at the Norwegian University of Science and Technology. We are exceptionally proud of our colleagues who have received major teaching awards for their adaptations of this subject at other universities, including Kenneth Yip at Yale, Brian Harvey at the University of California at Berkeley, and Dan Huttenlocher at Cornell.

43 | 44 |

Al Moyé arranged for us to teach this material to engineers at Hewlett-Packard, and for the production of videotapes of these lectures. We would like to thank the talented instructors—in particular Jim Miller, Bill Siebert, and Mike Eisenberg—who have designed continuing education courses incorporating these tapes and taught them at universities and industry all over the world.

45 | 46 |

Many educators in other countries have put in significant work translating the first edition. Michel Briand, Pierre Chamard, and André Pic produced a French edition; Susanne Daniels-Herold produced a German edition; and Fumio Motoyoshi produced a Japanese edition. We do not know who produced the Chinese edition, but we consider it an honor to have been selected as the subject of an “unauthorized” translation.

47 | 48 |

It is hard to enumerate all the people who have made technical contributions to the development of the Scheme systems we use for instructional purposes. In addition to Guy Steele, principal wizards have included Chris Hanson, Joe Bowbeer, Jim Miller, Guillermo Rozas, and Stephen Adams. Others who have put in significant time are Richard Stallman, Alan Bawden, Kent Pitman, Jon Taft, Neil Mayle, John Lamping, Gwyn Osnos, Tracy Larrabee, George Carrette, Soma Chaudhuri, Bill Chiarchiaro, Steven Kirsch, Leigh Klotz, Wayne Noss, Todd Cass, Patrick O’Donnell, Kevin Theobald, Daniel Weise, Kenneth Sinclair, Anthony Courtemanche, Henry M. Wu, Andrew Berlin, and Ruth Shyu.

49 | 50 |

Beyond the MIT implementation, we would like to thank the many people who worked on the IEEE Scheme standard, including William Clinger and Jonathan Rees, who edited the R4RS, and Chris Haynes, David Bartley, Chris Hanson, and Jim Miller, who prepared the IEEE standard.

51 | 52 |

Dan Friedman has been a long-time leader of the Scheme community. The community’s broader work goes beyond issues of language design to encompass significant educational innovations, such as the high-school curriculum based on EdScheme by Schemer’s Inc., and the wonderful books by Mike Eisenberg and by Brian Harvey and Matthew Wright.

53 | 54 |

We appreciate the work of those who contributed to making this a real book, especially Terry Ehling, Larry Cohen, and Paul Bethge at the MIT Press. Ella Mazel found the wonderful cover image. For the second edition we are particularly grateful to Bernard and Ella Mazel for help with the book design, and to David Jones, TEX wizard extraordinaire. We also are indebted to those readers who made penetrating comments on the new draft: Jacob Katzenelson, Hardy Mayer, Jim Miller, and especially Brian Harvey, who did unto this book as Julie did unto his book Simply Scheme.

55 | 56 |

Finally, we would like to acknowledge the support of the organizations that have encouraged this work over the years, including support from Hewlett-Packard, made possible by Ira Goldstein and Joel Birnbaum, and support from DARPA, made possible by Bob Kahn.

57 | 58 | 59 | -------------------------------------------------------------------------------- /content/book-Z-H-9.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Structure and Interpretation of Computer Programs 13 | 14 | 15 | 16 | 17 | 18 |

19 |

20 | 21 |

22 | 23 |
24 |

Chapter 1

25 | 26 |

Building Abstractions with Procedures

27 |
28 | 29 |
30 | 31 | 32 | 41 | 42 |
33 |
34 | “The acts of the mind, wherein it exerts its power over simple ideas, are chiefly these three: 1. Combining several simple ideas into one compound one, and thus all complex ideas are made. 2. The second is bringing two ideas, whether simple or complex, together, and setting them by one another so as to take a view of them at once, without uniting them into one, by which it gets all its ideas of relations. 3. The third is separating them from all other ideas that accompany them in their real existence: this is called abstraction, and thus all its general ideas are made.” 35 |
36 | 37 |
38 | John Locke, An Essay Concerning Human Understanding (1690) 39 |
40 |
43 |
44 | 45 |

We are about to study the idea of a computational process. Computational processes are abstract beings that inhabit computers. As they evolve, processes manipulate other abstract things called data. The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells.

46 | 47 |

A computational process is indeed much like a sorcerer’s idea of a spirit. It cannot be seen or touched. It is not composed of matter at all. However, it is very real. It can perform intellectual work. It can answer questions. It can affect the world by disbursing money at a bank or by controlling a robot arm in a factory. The programs we use to conjure processes are like a sorcerer’s spells. They are carefully composed from symbolic expressions in arcane and esoteric programming languages that prescribe the tasks we want our processes to perform.

48 | 49 |

A computational process, in a correctly working computer, executes programs precisely and accurately. Thus, like the sorcerer’s apprentice, novice programmers must learn to understand and to anticipate the consequences of their conjuring. Even small errors (usually called bugs or glitches) in programs can have complex and unanticipated consequences.

50 | 51 |

Fortunately, learning to program is considerably less dangerous than learning sorcery, because the spirits we deal with are conveniently contained in a secure way. Real-world programming, however, requires care, expertise, and wisdom. A small bug in a computer-aided design program, for example, can lead to the catastrophic collapse of an airplane or a dam or the self-destruction of an industrial robot.

52 | 53 |

Master software engineers have the ability to organize programs so that they can be reasonably sure that the resulting processes will perform the tasks intended. They can visualize the behavior of their systems in advance. They know how to structure programs so that unanticipated problems do not lead to catastrophic consequences, and when problems do arise, they can debug their programs. Well-designed computational systems, like well-designed automobiles or nuclear reactors, are designed in a modular manner, so that the parts can be constructed, replaced, and debugged separately.

54 | 55 |

56 | 57 |

Programming in Lisp

58 | 59 |

We need an appropriate language for describing processes, and we will use for this purpose the programming language Lisp. Just as our everyday thoughts are usually expressed in our natural language (such as English, French, or Japanese), and descriptions of quantitative phenomena are expressed with mathematical notations, our procedural thoughts will be expressed in Lisp. Lisp was invented in the late 1950s as a formalism for reasoning about the use of certain kinds of logical expressions, called recursion equations, as a model for computation. The language was conceived by John McCarthy and is based on his paper “Recursive Functions of Symbolic Expressions and Their Computation by Machine” (McCarthy 1960).

60 | 61 |

Despite its inception as a mathematical formalism, Lisp is a practical programming language. A Lisp interpreter is a machine that carries out processes described in the Lisp language. The first Lisp interpreter was implemented by McCarthy with the help of colleagues and students in the Artificial Intelligence Group of the MIT Research Laboratory of Electronics and in the MIT Computation Center.1 Lisp, whose name is an acronym for LISt Processing, was designed to provide symbol-manipulating capabilities for attacking programming problems such as the symbolic differentiation and integration of algebraic expressions. It included for this purpose new data objects known as atoms and lists, which most strikingly set it apart from all other languages of the period.

62 | 63 |

Lisp was not the product of a concerted design effort. Instead, it evolved informally in an experimental manner in response to users’ needs and to pragmatic implementation considerations. Lisp’s informal evolution has continued through the years, and the community of Lisp users has traditionally resisted attempts to promulgate any “official” definition of the language. This evolution, together with the flexibility and elegance of the initial conception, has enabled Lisp, which is the second oldest language in widespread use today (only Fortran is older), to continually adapt to encompass the most modern ideas about program design. Thus, Lisp is by now a family of dialects, which, while sharing most of the original features, may differ from one another in significant ways. The dialect of Lisp used in this book is called Scheme.2

64 | 65 |

Because of its experimental character and its emphasis on symbol manipulation, Lisp was at first very inefficient for numerical computations, at least in comparison with Fortran. Over the years, however, Lisp compilers have been developed that translate programs into machine code that can perform numerical computations reasonably efficiently. And for special applications, Lisp has been used with great effectiveness.3 Although Lisp has not yet overcome its old reputation as hopelessly inefficient, Lisp is now used in many applications where efficiency is not the central concern. For example, Lisp has become a language of choice for operating-system shell languages and for extension languages for editors and computer-aided design systems.

66 | 67 |

If Lisp is not a mainstream language, why are we using it as the framework for our discussion of programming? Because the language possesses unique features that make it an excellent medium for studying important programming constructs and data structures and for relating them to the linguistic features that support them. The most significant of these features is the fact that Lisp descriptions of processes, called procedures, can themselves be represented and manipulated as Lisp data. The importance of this is that there are powerful program-design techniques that rely on the ability to blur the traditional distinction between “passive” data and “active” processes. As we shall discover, Lisp’s flexibility in handling procedures as data makes it one of the most convenient languages in existence for exploring these techniques. The ability to represent procedures as data also makes Lisp an excellent language for writing programs that must manipulate other programs as data, such as the interpreters and compilers that support computer languages. Above and beyond these considerations, programming in Lisp is great fun.

68 | 69 |
70 |
71 |
72 | 73 |
74 |

1 The Lisp 1 Programmer’s Manual appeared in 1960, and the Lisp 1.5 Programmer’s Manual (McCarthy 1965) was published in 1962. The early history of Lisp is described in McCarthy 1978.

75 | 76 |

2 The two dialects in which most major Lisp programs of the 1970s were written are MacLisp (Moon 1978; Pitman 1983), developed at the MIT Project MAC, and Interlisp (Teitelman 1974), developed at Bolt Beranek and Newman Inc. and the Xerox Palo Alto Research Center. Portable Standard Lisp (Hearn 1969; Griss 1981) was a Lisp dialect designed to be easily portable between different machines. MacLisp spawned a number of subdialects, such as Franz Lisp, which was developed at the University of California at Berkeley, and Zetalisp (Moon 1981), which was based on a special-purpose processor designed at the MIT Artificial Intelligence Laboratory to run Lisp very efficiently. The Lisp dialect used in this book, called Scheme (Steele 1975), was invented in 1975 by Guy Lewis Steele Jr. and Gerald Jay Sussman of the MIT Artificial Intelligence Laboratory and later reimplemented for instructional use at MIT. Scheme became an IEEE standard in 1990 (IEEE 1990). The Common Lisp dialect (Steele 1982, Steele 1990) was developed by the Lisp community to combine features from the earlier Lisp dialects to make an industrial standard for Lisp. Common Lisp became an ANSI standard in 1994 (ANSI 1994).

77 | 78 |

3 One such special application was a breakthrough computation of scientific importance—an integration of the motion of the Solar System that extended previous results by nearly two orders of magnitude, and demonstrated that the dynamics of the Solar System is chaotic. This computation was made possible by new integration algorithms, a special-purpose compiler, and a special-purpose computer all implemented with the aid of software tools written in Lisp (Abelson et al. 1992; Sussman and Wisdom 1992).

79 |
80 | 81 | 82 | -------------------------------------------------------------------------------- /content/cc-by-nc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/cc-by-nc.png -------------------------------------------------------------------------------- /content/ch1-Z-G-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-1.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-10.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-11.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-12.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-13.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-14.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-15.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-16.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-17.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-18.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-19.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-2.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-20.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-21.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-22.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-23.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-24.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-25.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-26.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-27.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-28.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-29.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-3.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-30.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-31.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-32.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-33.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-34.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-35.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-36.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-37.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-38.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-4.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-5.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-6.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-7.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-8.gif -------------------------------------------------------------------------------- /content/ch1-Z-G-9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch1-Z-G-9.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-1.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-10.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-11.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-12.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-13.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-14.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-15.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-16.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-17.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-18.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-19.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-2.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-20.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-21.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-22.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-23.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-24.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-25.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-26.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-27.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-28.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-29.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-3.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-30.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-31.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-32.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-33.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-34.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-35.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-36.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-37.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-38.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-39.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-4.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-40.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-41.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-42.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-43.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-44.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-45.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-46.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-47.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-48.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-49.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-5.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-50.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-51.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-52.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-53.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-54.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-55.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-56.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-57.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-58.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-59.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-6.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-60.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-61.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-62.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-63.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-64.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-65.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-66.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-67.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-68.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-69.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-7.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-70.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-71.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-72.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-72.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-73.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-73.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-74.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-74.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-75.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-75.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-76.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-76.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-77.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-77.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-78.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-78.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-79.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-79.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-8.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-80.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-80.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-81.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-81.gif -------------------------------------------------------------------------------- /content/ch2-Z-G-9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch2-Z-G-9.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-1.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-10.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-11.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-12.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-13.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-14.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-15.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-16.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-17.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-18.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-19.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-2.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-20.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-21.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-22.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-23.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-24.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-25.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-26.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-27.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-28.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-29.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-3.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-30.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-31.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-32.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-33.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-34.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-35.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-36.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-37.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-38.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-39.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-4.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-40.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-41.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-42.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-43.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-44.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-45.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-46.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-47.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-48.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-49.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-5.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-50.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-51.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-52.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-53.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-54.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-55.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-56.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-57.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-58.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-59.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-6.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-60.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-7.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-8.gif -------------------------------------------------------------------------------- /content/ch3-Z-G-9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch3-Z-G-9.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-1.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-10.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-2.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-3.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-4.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-5.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-6.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-7.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-8.gif -------------------------------------------------------------------------------- /content/ch4-Z-G-9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch4-Z-G-9.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-1.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-2.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-3.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-4.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-5.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-6.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-7.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-8.gif -------------------------------------------------------------------------------- /content/ch5-Z-G-9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/ch5-Z-G-9.gif -------------------------------------------------------------------------------- /content/chip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/chip.jpg -------------------------------------------------------------------------------- /content/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/content/cover.jpg -------------------------------------------------------------------------------- /content/sicp.opf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Structure and Interpretation of Computer Programs 5 | en-us 6 | 0262011530 7 | Abelson and Sussman 8 | Structure and Interpretation of Computer Programs, 2nd edition 9 | Electronic Digital Computers -- Programming 10 | The MIT Press 11 | 2010-01-10 12 | 13 | 14 | cover.jpg 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /content/toc.ncx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Structure and Interpretation of Computer Programs 8 | 9 | 10 | Chapter 1 11 | 12 | 13 | 14 | Chapter 2 15 | 16 | 17 | 18 | Chapter 3 19 | 20 | 21 | 22 | Chapter 4 23 | 24 | 25 | 26 | Chapter 5 27 | 28 | 29 | 30 | References 31 | 32 | 33 | 34 | List of Exercises 35 | 36 | 37 | 38 | Index 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /lib/build_book.rb: -------------------------------------------------------------------------------- 1 | require 'properties' 2 | 3 | module Fix 4 | 5 | def self.chapters 6 | @chapters ||= BookBuilder.new.chapters 7 | end 8 | 9 | def self.do 10 | chapters.reject {|f| f == "book-Z-H-4.html"}.each do |file| 11 | doc = Hpricot(File.open(file).read) 12 | n = doc.search(".navigation") 13 | n.first.before( "") 14 | n.remove 15 | File.open(file, "w") {|f| f.puts doc} 16 | end 17 | end 18 | end 19 | 20 | class BookBuilder 21 | def chapters 22 | @chapters ||= get_chapters 23 | end 24 | 25 | def get_chapters 26 | files = Dir["book-Z-H*.html"].sort_by {|name| name[/\d+/].to_i} 27 | files.collect { |f| f.split(/\//).last } 28 | end 29 | 30 | def navigation_points 31 | lines = [] 32 | [ 33 | [9,9], 34 | [13,13], 35 | [19,19], 36 | [25,25], 37 | [30,30], 38 | [36,"References"], 39 | [37,"List of Exercises"], 40 | [38,"Index"] 41 | ].each_with_index do |chapter, i| 42 | number = i + 1 43 | label = chapter[1].is_a?(Fixnum) ? "Chapter #{number}" : chapter[1] 44 | 45 | lines << " " 46 | lines << " #{label}" 47 | lines << " " 48 | lines << " " 49 | end 50 | return lines 51 | end 52 | 53 | def ncx_toc 54 | %Q{ 55 | 56 | 57 | 58 | 59 | 60 | Structure and Interpretation of Computer Programs 61 | 62 | #{navigation_points.join("\n")} 63 | 64 | 65 | } 66 | end 67 | 68 | def manifest_items 69 | item_count = 0 70 | chapters.inject([]) do |lines, chapter| 71 | item_count += 1 72 | lines << " " 73 | end 74 | end 75 | 76 | def item_refs 77 | lines = [] 78 | manifest_items.size.times { |i| lines << " "} 79 | return lines 80 | end 81 | 82 | def opf 83 | %Q{ 84 | 85 | 86 | Structure and Interpretation of Computer Programs 87 | en-us 88 | 0262011530 89 | Abelson and Sussman 90 | Structure and Interpretation of Computer Programs, 2nd edition 91 | Electronic Digital Computers -- Programming 92 | The MIT Press 93 | #{Date.today} 94 | 95 | 96 | cover.jpg 97 | 98 | 99 | 100 | #{manifest_items.join("\n")} 101 | 102 | 103 | 104 | #{item_refs.join("\n")} 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | } 113 | end 114 | end 115 | 116 | if __FILE__ == $0 117 | 118 | Dir.chdir($LOCAL_ROOT) 119 | # Fix.do 120 | 121 | bb = BookBuilder.new 122 | 123 | File.open($NCX_TOC, "w") {|f| f.puts bb.ncx_toc} if ARGV.include?("toc") 124 | File.open($OPF, "w") {|f| f.puts bb.opf} if ARGV.include?("opf") 125 | 126 | system("~/mobigen/kindlegen #{$OPF} -c1 -rebuild -verbose > #{$LOG}") if ARGV.include?("build") 127 | end 128 | -------------------------------------------------------------------------------- /lib/properties.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'hpricot' 3 | 4 | $LOCAL_ROOT = "../content" 5 | #$LOCAL_ROOT = "../book/mit_contents" 6 | 7 | $TOC = "book-Z-H-4.html" 8 | $NCX_TOC = "toc.ncx" 9 | $OPF = "sicp.opf" 10 | $LOG = "mobi.out.txt" 11 | -------------------------------------------------------------------------------- /lib/tags.ruby: -------------------------------------------------------------------------------- 1 | !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ 2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ 3 | !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ 4 | !_TAG_PROGRAM_NAME Exuberant Ctags // 5 | !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ 6 | !_TAG_PROGRAM_VERSION 5.7 // 7 | Article build_book.rb /^class Article$/;" c 8 | BookBuilder build_book.rb /^class BookBuilder$/;" c 9 | articles build_book.rb /^ def articles$/;" f class:BookBuilder 10 | author_link build_book.rb /^ def author_link$/;" f 11 | author_then_date build_book.rb /^ def author_then_date$/;" f 12 | author_toc build_book.rb /^ def author_toc$/;" f 13 | author_toc_lines build_book.rb /^ def author_toc_lines$/;" f 14 | date_link build_book.rb /^ def date_link$/;" f 15 | date_then_author build_book.rb /^ def date_then_author$/;" f 16 | date_toc build_book.rb /^ def date_toc$/;" f 17 | date_toc_lines build_book.rb /^ def date_toc_lines$/;" f 18 | get_articles build_book.rb /^ def get_articles$/;" f class:BookBuilder 19 | header_html build_book.rb /^ def header_html(inner_text)$/;" f 20 | html_toc build_book.rb /^ def html_toc(author_or_date)$/;" f 21 | initialize build_book.rb /^ def initialize(file_name, full_title_string)$/;" f class:Article 22 | item_refs build_book.rb /^ def item_refs$/;" f 23 | manifest_items build_book.rb /^ def manifest_items$/;" f 24 | navigation_points build_book.rb /^ def navigation_points$/;" f 25 | ncx_toc build_book.rb /^ def ncx_toc$/;" f 26 | opf build_book.rb /^ def opf$/;" f 27 | other build_book.rb /^ def other(author_or_date)$/;" f 28 | parse_last_name build_book.rb /^ def parse_last_name$/;" f class:Article 29 | to_s build_book.rb /^ def to_s$/;" f 30 | -------------------------------------------------------------------------------- /sicp.mobi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanpatt/sicp-kindle/f8797b3d17016ca8ffa107dea60571d6c160b707/sicp.mobi --------------------------------------------------------------------------------