Computer Science Fundamentals (CS153 2003S)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
I like to run your programs to see what happens. Your output
is much nicer if you include calls to display in
the middle of your program.
You can, of course, create a separate testing file that includes those calls.
I also like to see the results of your tests included (but commented out).
Try to avoid lines longer than eighty chararacters. They can be a pain for me if I print them or try to edit them.
Here's a fun little procedure that you can use to display the code for a test followed by the value of a test.
(define test
(lambda (exp)
(display exp)
(newline)
(eval exp)))
For example
> (test '(+ 1 2)) (+ 1 2) 3
Many of you said complex numbers are not real
. That statement
is not precisely correct. The value 1 is complex and real
(and rational and integral). A better statement would be complex
numbers with an imaginary component are not real
.
Many of you were fairly casual in your definitions of procedures. For example,
quotientfinds the quotient of two values.
maxfinds the maximum value of its parameters.
But what does it mean to be a quotient or a maximum?
Here's a start for quotient:
For positive integers a and b, the quotient of a and b is the largest integer, q, such that q*a <= b.
Here'a start for max:
For non-complex numbers v1 ... vn, the maximum of those numbers is a vi such that vi >= vj for all j from 1 to n.
round
Many of you did not sufficiently test round. Note that
> (round 1.5) 2 > (round 2.5) 2
What does this suggest about round?
max
At least one of you noted the following interesting behavior of
max. I thought I'd share it with the rest of you.
> (max 1.5 3/2) 1.5 > (max 3/2 1.5) 1.5
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 6 09:20:11 2003.
The source to the document was last modified on Mon Feb 3 09:35:22 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/2003S/Labs/writeup-notes.01.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby