Using Concrete Abstractions with DrRacket (formerly DrScheme)

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

The information here currently corresponds with versions 6.0. We will try to track new versions as they come out. We also have support for the older versions 4.0-5.3.6, 370-372, 300-360, 201-209, 200, 103, 102, 101, 100, and 53. (Prior to version 5.0, the program now known as DrRacket was called DrScheme.)

Obtaining DrRacket

DrRacket is an implementation of Scheme, including a graphical user environment, that is freely available. It can be obtained from the web. Versions are available for Windows (95 and later), OS X, and various versions of Linux and Unix with X Windows. As far as we can tell, DrRacket seems quite well suited for use with our book; we'd like to hear of any problems you encounter.

Settings for DrRacket

DrRacket can be set to use any of several variants of the Scheme language. You will need to set this when you first start up DrRacket, by using the Language menu's Choose Language... option. For compatibility with Concrete Abstractions, select to the "Pretty Big" language listed under the "Legacy Languages" heading.

By default, this language setting causes DrRacket to forbid you from redefining any name for which it already has a built-in definition. This creates problems because Concrete Abstractions assumes that you can define some names (listed subsequently) that DrRacket already has defined. To avoid this issue, use the Show Details button within the Change Language... panel and then uncheck the box labeled "Disallow redefinition of initial bindings".

Also, this language setting causes DrRacket to be "case sensitive" by default. For example, the symbols barbara and Barbara are treated as distinct, contradicting Exercise 13.18. If you consider compatibility in this regard to be important, you can use the Show Details button within the Change Language... panel and then turn case sensitivity off.

Libraries for use with DrRacket

There are two areas of the textbook for which a special "library" needs to be loaded into DrRacket. One is the graphical images, introduced in the application section of chapter 1 and also used in subsequent chapters. The other is the object-oriented programming system, used in chapter 14.

The libraries can be installed by using DrRacket's "Install Package..." command in the File menu, specifying a package source of https://gustavus.edu/+max/concabs/schemes/drscheme/concabs.zip

To use the library for graphical images, your definitions file within DrRacket should start with the line

(require (lib "fungraph.ss" "concabs"))

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.

To use the object-oriented programming system library for chapter 14, your definitions file within DrRacket should start with the line

(require (lib "oops.ss" "concabs"))

General notes

Names defined in both Concrete Abstractions and DrRacket

There are a number of names that we define in Concrete Abstractions that are already pre-defined in DrRacket. 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 DrRacket documentation. (Also, as previously described, you need to have explicitly told DrRacket to allow such redefinitions.)

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 DrRacket (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 6
This chapter first introduces interactive programs, which display output and read input. See the note above regarding the positioning of (newline).
Chapter 9
For the application section, we have a DrRacket-specific version of the show procedure.
Chapter 10
Be warned that DrRacket has its own pre-defined procedure read-eval-print-loop, which gives a normal Scheme (as opposed to micro-Scheme or mini-Scheme) REPL. Thus, if you fail to execute the definition from the book, you could be fooled by DrRacket's loop into thinking that everything is working fine. To guard against this, be on the lookout for the different prompts; micro-Scheme and mini-Scheme both specifically identify themselves in their prompts.
Chapter 11
Although you could use the SLIM simulator from the application section to work through the earlier sections of this chapter under DrRacket, you'd be better off using SLIME.
Chapter 14
You will need to load a library into DrRacket to get the object-oriented programming system, as described above.
Chapter 15
DrRacket 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 or later system instead.

For more information, see the parent web page, or contact Max Hailperin:
Email: max@gustavus.edu
Mathematics and Computer Science Department
Gustavus Adolphus College
800 W. College Avenue
St. Peter, MN 56082
USA
Revision 1.67 as of 2014/03/26 21:12:37