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 is the essence of
list structure’s importance as a representational tool. We refer to
this ability as the closure property of cons. In general, an operation for combining data objects satisfies the closure property
if the results of combining things with that operation can themselves
be combined using the same operation.[6] Closure is the key to power in any means of combination because it permits us to create hierarchical structures — structures made up of parts, which themselves are made up of parts, and so on.
From the outset of chapter 1, we’ve made essential use of closure in dealing with procedures, because all but the very simplest programs rely on the fact that the elements of a combination can themselves be combinations. In this section, we take up the consequences of closure for compound data. We describe some conventional techniques for using pairs to represent sequences and trees, and we exhibit a graphics language that illustrates closure in a vivid way.[7]

Comments
Beats By Dre Monster
SYNC by 50 If you’re like most of us, you woke up one morning this week and realized it’s almost December,SYNC by 50 and the holidays are swiftly approaching. STREET by 50 And, of course, you still don’t know what to get a few people on your list.We all know that headphones are a dime a dozen. STREET by 50 But a headphone that receives equal points for style and functionality, however, is a rare find. sms by 50 Some of our friends in the press know SMS Audio headphones fit the bill, sms by 50 and recommend you put them on your holiday shopping list this year: Beats By Dre Monster Rolling Stone included the limited edition Yellow STREET by 50 over-ear headphones in its 2012 holiday gift guide featured in the December issue.Beats By Dre MonsterWhat did Rolling Stone have to say about SMS Audio?
http://www.smsby50-beatsbydre.com/
Post new comment