Exercise #9

The file /home/stone/courses/scheme/examples/population-data.ss contains a body of information about the ninety-nine counties of the state of Iowa: their names, their populations in 1990 and in 2002, and their areas (in square miles). The information is presented in the form of a Scheme definition that constructs and names a vector in which each element is a record giving these four facts about counties:

(define population-data
  (vector
    (make-county "Adair" 8331 7987 570)
    (make-county "Adams" 4553 4384 426)
    (make-county "Allamakee" 13941 14591 660)
        ...
    (make-county "Woodbury" 101187 103331 877)
    (make-county "Worth" 7874 7766 402)
    (make-county "Wright" 14201 13986 582)))

This definition presupposes that there is a make-county procedure that constructs and returns such records. The first part of the exercise, therefore, is to design and implement the primitive procedures for county records, including the constructor make-county.

With these procedures, program the computer to answer some questions about Iowa demographics:

This exercise will be due at 9 a.m. on Wednesday, April 28.


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~stone/courses/scheme/exercises/9.xhtml

Validated as XHTML 1.1 by the World Wide Web Consortium Cascading Style Sheet validated by the World Wide Web Consortium

created April 21, 2004
last revised April 23, 2004

John David Stone (stone@cs.grinnell.edu)