Structure and Interpretation of Computer Programs Recitation 106.001 Mar. 5, 2004Symbols and Quote1. Quiz statisticsA >= 85 B >= 70 C >= 55 D >= 42 ¯x = 702. SymbolsSymbols are atomic. Symbols are also interned Th e fact that they have textual representationis just for the programmer.3. QuoteReturns, literally, Scheme’s internal copy of the code inside the quote. ’(1 2 3) is syntacticsugar for (quote (1 2 3))4. Equality= Numerical equivalence only.eq? Referential equivalence. Always works for symbols.eqv? Almost referential equivalence. Also works for numbers.equal? Representational equivalence. Do they look the same?Problems1. QuotingWhat do the following expressions desugar to?’*’(1 2 (3 4))’4Evaluate the following expressions.’(2 3 4)(quote (+ 1 2))’’a’nil’5’(1 ’a b)(’+ 3 4)(cons ’a ’(b))(if ’(= 1 0) 5 10)(if ’#f 5 10)16.001: SICP Recitation 102. Equality(= ’2 2)(eq? ’x ’X)(eq? "x" ’x)(eq? 9876543210 9876543210) (But don’t do that!)(eq? 2 2) (or that!)(eq? (list 1 2) (list 1 2))(eq? car car)(eq? (car (list 1 2)) (car (list 1 2)))(equal? (list 1 2) (list 1 2))(equal? ’x ’x)(equal? (list cdr +) ’(cdr +))(eqv? 9876543210 9876543210)3. BrainteaserCan you write a non-atomic self-printing expression? (that is, an expression that, when eval-uated, prints out exactly as the expression itself. 2, "foo", #f are all self-printing expressions,but they are
View Full Document