Com S 342 --- Principles of Programming Languages EXERCISE 00: DATATYPES (File $Date: 2005/01/12 09:33:06 $) The purpose of this exercise is for you to think about the data and operations that should be in a general purpose programming language. As with all exercises, this is to be done individually. It is due the day this topic is planned to be discussed in class (see the syllabus: http://www.cs.iastate.edu/~cs342/syllabus.shtml). We expect this to help you think about the readings (see below). If you don't have an answer or an answer that you think is good, write down what you read, and a question or two that would have helped you make progress. Then you can ask that question in class; there will be other people with the same problem, and everyone can learn by discussing these issues. And you'll most likely see similar things on the homework, so it's best to understand them now. 1. [Data types for a General Purpose Language] Read the first part of section 1.1 (on page 4) of the recommended textbook "Structure and Interpretation of Computer Programs", by Abelson and Sussman, which is on reserve and also on-line at the following URL. http://mitpress.mit.edu/sicp/ Consider the design of a language like Scheme, we'll call Simple, that is a general purpose programming language designed to be simple and uniform. a. Name 2 simple (atomic) datatypes that you would like to have in such a language. Such a type should have no component parts; for example, nanoseconds would be (a silly example of) such a type. b. Name 2 operations that (like hyperbolic cosine), that should be present in the language for each of these types (a total of 4). c. Name 2 complex (non-atomic) datatypes that you would like to have such a language. Such a type should have some component parts; for example, Person records that store a name, age, and address would be such a type. WHAT TO HAND IN You should have at the beginning of class, printed (not handwritten) answers (or questions if you encountered problems). Handwritten answers aren't accepted because we want you to read and think a bit before class starts. Don't hand these in at the beginning of class, but use them in the discussion, and then hand them in at the end of class. ADDITIONAL READINGS If you have time, read pages 1-31 (up to the start of section 1.2) of the recommended textbook "Structure and Interpretation of Computer Programs", by Abelson and Sussman, which is on reserve and also on-line at the following URL. http://mitpress.mit.edu/sicp/