Using Concrete Abstractions with (Petite) Chez Scheme

This web page provides information regarding the use of the Chez Scheme implementation of Scheme (and its Petite variant) with Concrete Abstractions: An Introduction to Computer Science Using Scheme, by Max Hailperin, Barbara Kaiser, and Karl Knight.

The information here has been tested with the version 6.0a of Petite Chez Scheme and (in the case of graphics) version 0.9u of SWL. Although no testing was done with non-Petite Chez Scheme, it should work equally well in version 6.0; we will try to track new versions of Chez Scheme as they come out.

Obtaining (Petite) Chez Scheme

Chez Scheme is an implementation of Scheme that is sold by Cadence Research Systems. Petite Chez Scheme is a variant that lacks the compiler, and which they make available without charge. SWL is a graphics add-on contributed by Indiana University. It also provides a graphical user interface, including a simple editor. For more information, or to download Petite Chez Scheme and SWL, see the Cadence web page. Versions are available for Windows and various versions of Linux and Unix with X Windows. So far we have only tested Petite Chez Scheme with the software for our book under Linux. However, we don't know of any reason why our book wouldn't work equally well with Chez Scheme on other systems. We'd like to hear of any problems you encounter.

Libraries for use with Chez Scheme

There are three aspects of the textbook for which a special library needs to be loaded into Chez Scheme. One is our use of the error reporting procedure, error, from chapter 6 onward, as well as in the other two libraries. Another is the graphical images, introduced in the application section of chapter 1 and also used in subsequent chapters. The final one is the object-oriented programming system, used in chapter 14.

Each of these libraries can be downloaded from the web below. Once you have one of the library files on your system, you can load it into Chez Scheme using the load procedure. For example, you could evaluate (load "") to load in the error library. If the file isn't in your current directory (folder) you might need to specify a pathname, such as (load "/usr/local/scheme-libraries/") or (load "c:\\scheme\\libraries\\").
This defines the error reporting procedure, error. Not only is this used from chapter 6 onward, it is also used in the other two libraries. Therefore, you must load this one if you load either of the other two. Important note: Chez Scheme comes with its own definition of error, which is not compatible with the textbook. Therefore, if you don't load this library in, you will have more obscure symptoms than simply the procedure not being defined. The library file re-defines it in such a way as to be compatible with both the textbook's usage and the usage shown in the Chez Scheme documentation.
This is the library for graphical images. In addition to the features described in the textbook (most succinctly in the appendix), there are a few extensions. Descriptions of those extensions and a couple hints regarding usage are in a separate web page. Note that this library needs to be used with SWL.
This is the object-oriented programming system for use with chapter 14.

General notes

Names defined in both Concrete Abstractions and Chez Scheme

There are a number of names that we define in Concrete Abstractions that are already pre-defined in Chez Scheme. The only real problem this causes is that if you perform the definition from the book, you can't expect the name to simultaneously have both the new value and the one described in the Chez Scheme documentation.

For each name, except for time (which is special syntax in Chez Scheme), the Chez Scheme definition remains available by prefixing the name with #%. For example, if in chapter 7 you have defined length to be your own procedure, you can still use Chez Scheme's version using #%length. Or, you can return to the original definition of length by using (define length #%length)

We list below the affected names, organized into categories and listed within each category in their order of their appearance within the book:

Positioning of (newline)

Starting in chapter 6, we use the newline procedure to break output into separate lines. Unfortunately, there are two different conventions in use by different Scheme systems. One is to always use newline at the start of each line of output, while the other is to always use it at the end of each line. As a result of this lack of standardization, wherever we positioned the uses of (newline) in our programs would result in output that looked odd on some systems. We've tried in the textbook to make choices that don't look too horrible on any system, with the result that the output tends to look sub-optimal on every system. In particular, there tends to be extra blank lines. If you are working consistently within Chez Scheme (or any other one system), feel free to remove or reposition (newline) as necessary to make the output look best.

Chapter by chapter notes

Chapter 1
The procedures for manipulating graphical images need to be loaded from a library, as described above. Additionally, it is worth noting that the various basic blocks, such as rcross-bb, are neither pre-defined nor defined within the library. Instead, their definitions are in a separate file.
Chapter 9
For the application section, we have a Chez Scheme-specific version of the show procedure. Also, note that Chez Scheme's with-output-to-file signals an error if the file already exists.
Chapter 11
Although you could use the SLIM simulator from the application section to work through the earlier sections of this chapter under Chez Scheme, you'd be better off using SLIME.
Chapter 14
You will need to load a library file into Chez Scheme to get the object-oriented programming system, as described above.
Chapter 15
Chez Scheme cannot be used for this chapter, since this chapter doesn't use the Scheme programming language. You will need to use a Java 1.1 system instead.

For more information, see the parent web page, or contact Max Hailperin:
Mathematics and Computer Science Department
Gustavus Adolphus College
800 W. College Avenue
St. Peter, MN 56082
Revision 1.4 as of 1999/11/15 20:26:28