CS 3 (Garcia) Spring 2001 Homework assignment 1
Solutions to the following problems are due by 6pm on Friday, January 26. Do both parts. This homework will be handed in rather than graded face-to-face; deposit your solutions in box labeled with the lab section you will be attending next week "CS 3" in 283 Soda Hall.
Please put your name and lab section time on each page you hand in.
Part I: Computer Use
Goals
This part of the assignment is intended to get you to think about (and perhaps remember better) the activities you did for lab assignment 1.
Problem 1
Suppose that you have created a new editor window and typed the expression (+ 4 3) into it. Give three different sequences of keystrokes (not including any backspaces) or mouse manipulations that result in the evaluation of the expression.
Problem 2
Suppose, immediately after starting Gambit, you type the line
(/ 2 0)
immediately followed by a carriage return. You would expect some sort of error message about dividing by zero, but nothing happens. Why not?
Problem 3
Suppose, after you have interacted with Gambit for a while, it types the characters "3 :" at you in the Interaction window. What does that mean, and what should you do about it? Briefly explain.
Problem 4
A CS 3 student sits down at the computer to do lab assignment 1. After the student leaves, a t.a. finds a file on the hard disk called lab 1.scm that wasn't on the hard disk before the student used the computer. Exactly where in lab assignment 1 did the student make a mistake, and what was the mistake?
Part II: Working with functions
Goals
This part of the assignment is intended to give you practice combining and reasoning about functions. We hope in this way to introduce you to some of the analysis-related activities you'll be doing when you write your own functions later in the course.
Exercises
Do exercises 2.1, 2.2, 2.3, 2.4, 2.5, and 2.6 on pages 24 and 25 in Simply Scheme.
Page