Structure and Interpretation of Computer Programs
As we have seen, pairs provide a primitive ``glue'' that we can use to construct compound data objects. Figure 2.2 shows a standard way to visualize a pair -- in this case, the pair formed by (cons 1 2). In this representation, which is called box-and-pointer notation, each object is shown as a pointer to a box. The box for a primitive object contains a representation of the object. For example, the box for a number contains a numeral. The box for a pair is actually a double box, the left part containing (a pointer to) the car of the pair and the right part containing the cdr. We have already seen that cons can be used to combine not only numbers but pairs as well. (You made use of this fact, or should have, in doing exercises 2.2 and 2.3.) As a consequence, pairs provide a universal building block from which we can construct all sorts of data structures. Figure 2.3 shows two ways to use pairs to combine the numbers 1, 2, 3, and 4. The ability to create pairs whose elements are pairs i
Structure and Interpretation of Computer Programs [Go to first , previous , next page ; contents ; index ] 2.2 Hierarchical Data and the Closure Property As we have seen, pairs provide a primitive ``glue'' that we can use to construct compound data objects. Figure 2.2 shows a standard way to visualize a pair -- in this case, the pair formed by (cons 1 2) . In this representation, which is called box-and-pointer notation , each object is shown as a pointer to a box. The box for a primitive object contains a representation of the object. For example, the box for a number contains a numeral. The
Explore this link on the map →saved by
related reading
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- how I think when I think about programming - alice mazalicemaz.com
- 2.3 Sequencescomposingprograms.com
- CSC 151 - The "big three" list operationseikmeier.sites.grinnell.edu
- CSC 151 - Higher-order design, recursive and othereikmeier.sites.grinnell.edu
- adventures in uncertainty: An Introduction to Recursion Schemesblog.sumtypeofway.com
- CSC 151 - Anonymous procedureseikmeier.sites.grinnell.edu