Fundamentals of Computer Science 1 (CS151 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]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Scheme Reference]
[Scheme Report]
[CS151 2003S Gum]
[CS151 2002F]
[CS151 History]
[SamR]
Summary: We investigate records in Scheme through experiments with a record for chemical compounds.
Contents:
a. Start DrScheme.
b. Make a copy of compound.ss
.
c. Scan through that file to make sure that you understand all the procedures.
a. Try the compoound examples given in the reading on records to see if they behave as I said they would.
b. Try a few of your own variations.
c. Explain why the attempted fake is not listed as a compound. Hint:
Think about the order of the let
and lambda
in produce-type-mark
.
Define a procedure, filter-by-color
, that takes two arguments --
a list compounds
of records of type compound
and
a color symbol -- and returns a list of the names of compounds of that
color that are elements of compounds
.
a. Can you set the melting point of a compound to an illegal temperature? If so, how? If not, why not? (Note that there are other ways to modify compounds than to use the record's provided procedures.)
b. Find a way to make a vector that compound?
identifies
as a compound. You may not use make-compound
or
compound-copy
to build your new vector. However,
you may use either procedure to create a helper
compound
from which you copy values.
Write a set of definitions for a record type, shirt
, to
be used in a program that keeps track of the inventory of a clothing store.
Provide fields for catalog number, intended gender of wearer, size, color,
price, and quantity in stock. Only the last two fields should be mutable.
Adapt the binary search procedure so that it takes two arguments -- a
sorted vector, vec
, of records of type shirt
and a catalog number, catno
-- and returns the entire record
that contains that catalog number, if there is one in vec
,
or #f
if there is no such record.
Define a procedure that sorts a vector of records of type
shirt
into ascending order by catalog number.
Write an expression that, through an appropriate call to
mergesort
, sorts a list of shirts by catalog number.
Rewrite your answer to the first sorting problem by using your answer to the previous problem.
Monday, 27 November 2000 [Samuel A. Rebelsky]
http://www.math.grin.edu/~stone/courses/scheme/records.xhtml
(Created April 29, 1997; Last modified April 21, 2000)
http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2000F/Labs/records.html
.
Monday, 30 April 2001 [Samuel A. Rebelsky]
http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2001S/Labs/records.html
.
Tuesday, 3 December 2002 [Samuel A. Rebelsky]
http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2002F/Labs/records.html
.
Tuesday, 29 April 2003 [Samuel A. Rebelsky]
http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2003S/Labs/records.html
.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Scheme Reference]
[Scheme Report]
[CS151 2003S Gum]
[CS151 2002F]
[CS151 History]
[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:29:11 2003.
The source to the document was last modified on Tue Apr 29 21:08:53 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2003S/Labs/records.html
.
;
;
Check with Bobby