6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 8.1.1 a useful property of the quote special form In fact, our Scheme evaluator is smart, and it keeps track of list (quote delta) (quote delta)) what symbols have been created so far. As a consequence, when we refer to a symbol, Scheme gives us a pointer to the unique instance of that symbol. We can illustrate that as shown, by evaluating this ex This will create a list of two elements, both of which happen to be the symbol delta 4 Slide 8.1.19 A useful property of the quote special form Scheme will create a box-and-pointer structure for a two- element list. But the car of both cons pairs in this list now (list (quote delta) (quote delta)) point to exactly the same object inside of the machine, namely the data structure for the symbol delta symbol delta A useful property of the quote special form Slide 8.1. 20 This is valuable, because it gives us a way of creating (list (quote delta) (quote delta) predicates for testing equality of symbols, and indeed other more complicated objects, as we will see a bit later on symbol delta Two quote expressions with the same name return the same Slide 8. 1.21 The operation eq? tests for the same object Our predicate for testing equality of symbols is eg? This is a very powerful procedure, used to test equality of a range of returns #t if its two arguments are the same object structures, as we will see. Ea? is a primitive procedure (i.e something built into Scheme), and it returns the boolean value true"if its two arguments are the same object. For our context, that says that since we create only one instance of each symbol using eq? to test equality of symbols will return true if the two expressions evaluate to a pointer to the same symbol data structure 600SC6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 8.1.18 In fact, our Scheme evaluator is smart, and it keeps track of what symbols have been created so far. As a consequence, when we refer to a symbol, Scheme gives us a pointer to the unique instance of that symbol. We can illustrate that as shown, by evaluating this expression. This will create a list of two elements, both of which happen to be the symbol delta. Slide 8.1.19 Scheme will create a box-and-pointer structure for a twoelement list. But the car of both cons pairs in this list now point to exactly the same object inside of the machine, namely the data structure for the symbol delta. Slide 8.1.20 This is valuable, because it gives us a way of creating predicates for testing equality of symbols, and indeed other more complicated objects, as we will see a bit later on. Slide 8.1.21 Our predicate for testing equality of symbols is eq?. This is a very powerful procedure, used to test equality of a range of structures, as we will see. Eq? is a primitive procedure (i.e. something built into Scheme), and it returns the Boolean value "true" if its two arguments are the same object. For our context, that says that since we create only one instance of each symbol, using eq? to test equality of symbols will return true if the two expressions evaluate to a pointer to the same symbol data structure