DOC PREVIEW
MIT 6 001 - Symbols and Quote

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

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

MIT 6 001 - Symbols and Quote

Documents in this Course
Quiz 1

Quiz 1

6 pages

Databases

Databases

12 pages

rec20

rec20

2 pages

Quiz II

Quiz II

15 pages

Streams

Streams

5 pages

Load more
Download Symbols and Quote
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Symbols and Quote and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Symbols and Quote 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?