CS 450 Homework 1
Carl Offner
Fall 2009

(Taken from a similar assignment due to Prof. Bolker)


Part I. Due Monday, September 14, in class.
  1. Apply for a department Unix account in the usual way. Do that even if you already have a Unix account, so that you can tell the system that you are enrolled in this course. Do not ever change the protections on this account (or on any files or subdirectories in it).
  2. Read pages 1-21 of the text (Abelson and Sussman's Structure and Interpretation of Computer Programs) once over lightly, and try not to worry about what doesn't seem clear. Answer the following exercises:

To test your answers and your understanding you will want to be able to play with Scheme while you read the text. To run the UMB Scheme interpreter simply type

	% scheme

at the Unix prompt. Then enjoy.

To work with a file of Scheme code rather than simply typing at the Scheme prompt you can redirect input (and output) with

	% scheme < somefile.scm > somefile.out

or (load "somefile.scm") while in Scheme.

Note: Your answers to the exercises should come along with (or be incorporated in) a short essay in which you discuss what you discovered about Scheme. How does it compare to other languages you know? Did any of its responses surprise you? What is the largest integer Scheme will handle? What message appears when you type '+' at the Scheme prompt (and what does the message mean)? What other experiments did you perform? What do you like or dislike (so far) about Scheme?

This essay and the others I will regularly ask for are an important part of how you learn, and an important part of your grade. I usually read them before I read your code. So take them seriously.


Part II. Due Wednesday, September 16, 5:00 PM.
(Collected electronically.)

When your application for a Unix account for this course was processed, a cs450 subdirectory of your home directory was created for you. You are to do all your work for this course there. Do not ever change the protections on this directory (or on any files or subdirectories in it).

Create a hw1 subdirectory of your cs450 directory. Do your work for this assignment there.

Emacs knows about Scheme. It edits files with the .scm extension in Scheme mode. In that mode, the tab key will indent code correctly. You can run Scheme in a shell buffer in emacs, which is convenient for cutting and pasting code from a file you are editing. If you are not an emacs user you should definitely learn that editor now. It's much more powerful than vi; that power will save you lots of programming time.

And by the way, I occasionally have students who try to do their work in Microsoft Word and then somehow turn it back into plain text. They end up wasting an incredible amount of time doing this, and their work looks like a mess. Don't fall into this trap. Use emacs, and if you need help, just ask me, or send me email.

Rapidly read through the Scheme language report ("Revised5 Report on the Algorithmic Language Scheme"; this is usually referred to as "R5RS"). Do not try to learn everything that's there. Skip all the hard parts. Use this reading to learn the kinds of things that can be found there, so you can look things up when you need to.

Put the answers to the exercises listed below in a file named ASanswers.txt in your hw1 directory. Your answers should be written out in complete paragraphs. Your work should be sufficiently self contained so that three months from now you will be able to look at them and understand them without having to go back to the book to see what the question was, or the point of the question.

This file should be a plain ASCII text file. You will have to rely on white space for formatting. It's too much of a nuisance for me to try to deal with a file containing embedded formatting characters, whether it is Microsoft word or HTML. And please make sure that all your lines in this file are 80 characters or less in length. If you put this line

    (setq-default fill-column 80)

in your ~/.emacs file, this will help you. But you still have to make sure that your lines haven't run over. (And yes, I really mean this. I'm taking off points if lines run over. If you don't know what I mean, ask me or send me email.)

Remember that unix file names are case sensitive. Here are three file names that are incorrect:

Do you see what is wrong with each of them? If you name your file even slightly incorrectly, my collecting script will not find it, and I will never see your homework. It is not my responsibility to go rummaging around in your directory to try to figure out what you have named your files. So please be careful with filenames. It will save us both a lot of grief.

Here are the exercises you should do:

  1. 1.9 (page 36). You have to justify your answer in each case. Please write clearly. A good way to tell if you have answered this question correctly is this: would you understand it if someone else explained it to you this way? That's the way I'm going to judge it, anyway.
  2. 1.11 (page 42). Be sure to discuss how you tested your procedure.
  3. For extra credit: 1.16 (page 46). Be sure to discuss design and testing.