Assigned 9 Feb, due 19 Feb.
To get a feel for object-oriented programming in CLOS, we'll write a
simple database package that records information about students and the
courses they're taking. That's Homework 3. Homework 2 will be just the
first step towards this database package.
Every person has a name (stored as a string).
The following functions represent the user interface to the program.
- (make-person ['name "person's name"])
- creates a new person, with initial status as specified by the
optional arguments, and returns the person object. For
(make-person 'name "Bloch") would return a person with name
I would more likely use this function in the form
(define bloch (make-person 'name "Bloch"))
which not only creates a new instance of the class, but sets
the variable "bloch" to refer to that instance.
- (describe person)
- prints the person's name, using the Scheme "display" function.
It may or may not return anything useful.
- (name-of person)
- returns the person's name.
- (slot-set! person 'name "new name")
This is the ordinary TCLOS slot-set! function, which we can use
to change the name of an existing person. You don't have to write this
one, since it's already provided by TCLOS.
Fri Feb 16 13:37:33 EST 1996
Stephen Bloch / firstname.lastname@example.org