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:

6.001, Spring 2005—Recitation 7 16.001—Structure and Interpretation of Computer ProgramsSpring 2005Recitation 7Types and higher-order proceduresTypesTypes can look like this:• Basic types: Number, Boolean, String...• Variable types: A, B, C... can represent any type, but they’re the same type each time• Procedures: for example, (N umber, Number → Number), (A → A), (Number → Boolean)...• Compound types: P air < A, B > or List < A >Problems1. What is the type of cons?2. What is a more specific type of cons, when we use it to adjoin an element to a list?3. What is the type of map?4. What is the type of filter?5. What is the type of accumulate?Higher-order procedures1. Let’s write a procedure, twice, that takes any one-argument procedure and returns a newprocedure that does it twice. For example, (twice square) is a procedure that raises thingsto the fourth power, so ((twice square) 3) is 81.6.001, Spring 2005—Recitation 7 22. What is the type of twice?3. Write thrice.4. What is the type of thrice?5. What should we call (twice thrice)? Is it the sam e as (thrice twice)?6. How is ((twice thrice) f) different from (twice (thrice f))?7. What are we reimplementing?8. Is that cool or


View Full Document

MIT 6 001 - Study Guide

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 Study Guide
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 Study Guide 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 Study Guide 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?