Computer Science Fundamentals (CS153 2004S)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Search]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[Experiments in Java]
[Java API]
[Scheme Reference]
[Scheme Report]
[CS153 2003S]
[CS151 2003F]
[CS152 2000F]
[SamR]
Back to Procedures. On to Recursion with Lists.
Held: Wednesday, 28 January 2004
Summary: Today we begin to learn how to tell Scheme to make decisions. The procedures used to make decisions are called conditionals. Today's class will be a large group design effort rather than an individual or small group design effort.
Related Pages:
grade.scm: Sample code.Due
Assignments:
Notes:
Overview:
ifif. For example,
if the grade is at least 94, then give the student an A, otherwise, if the grade is between 90 and 93, ...
(if condition
success-expression
failure-expression)
if does not behave according to
Marie's evaluation pattern (in which all the arguments
to a procedure are computed before the procedure is applied).
(if (>= grade 94) 'A 'F)
(if (>= grade 94)
'A
(if (<= 90 grade 93)
'Aminus
(if (<= 87 grade 90)
...)))
cond, which more closely resembles a table.
cond expression looks like
(cond ((condition1) exp1) ((condition2) exp2) ((condition3) exp3) ... (else default-exp))
(cond ((>= grade 94) 'A) ((<= 90 grade 93) 'Aminus) ...)
#t) or false
(#f).
< (strictly less than),
<= (less than or equal to),
= (equal to),
>= (greater than or equal to),
and
> (strictly greater than).
=,
eq?,
eqv?, and
equal?.
and,
or, and not.
Back to Procedures. On to Recursion with Lists.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Search]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[Experiments in Java]
[Java API]
[Scheme Reference]
[Scheme Report]
[CS153 2003S]
[CS151 2003F]
[CS152 2000F]
[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 Fri May 7 09:43:04 2004.
The source to the document was last modified on Tue Jan 13 10:26:10 2004.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/2004S/Outlines/outline.05.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby