Scheme Library

This page is organized as follows:

  1. Getting Library Files
  2. Customizing Your Copy of the Library (localize.scm)
  3. Getting Homework Files
  4. Working with our Test Drivers
  5. Other Ways to use the Library

Getting Library Files

If you are working on your own machine, you must put the course's Scheme library a directory named lib342 underneath the collects directory of PLT. That is, if DrScheme is installed in c:\cygwin\usr\local\PLT, then you should have a directory c:\cygwin\usr\local\PLT\collects\lib342, containing the files for the library.

You can download individual files from the course Scheme library from lib342/.

From departmental Unix machines, you can also access the library files via the following command:

$ cd /opt/plt/collects/lib342

Note: In code examples, green text is program output, yellow bold text is user input, and cyan text is sample code.

However, a more reliable way to get the library files is to download a .zip file containing the course library. That zip file contains most of the files in the library. You should unzip it to the PLT/collects directory, which is the directory named collects directly underneath the DrScheme installation directory. When you do the unzip, be sure to preserve the directory structure, which will make sure that you have a directory named lib342 in PLT/collects.

Return to top

Customizing Your Copy of the Library (localize.scm)

There are only two files not contained in the zip file:

These files are not included because they must be customized to your machine.

If you are using DrScheme only (and not Chez Scheme) then you only need to worry about the localize.scm file. This file tells the rest of the library where to find the other files. Because it is tailored to your machine, it must be downloaded individually and customized once. After that you should never have to download it again. Comments in this file indicate what to change to customize it.

See also the library file localize-example.scm, which is another example of what would go in your copy of localize.scm.

Finally, to start using DrScheme, select the Typedscm language from the Language menu. See the running Scheme web page for more details.

If you are using Chez Scheme, then, in addition to customizing the localize.scm file you must also customize the chez-localize.scm file. See also the library file chez-localize-example.scm, which is another example of what would go in your copy of chez-localize.scm.

Return to top

Getting Homework Files

You will also need to separately download the homework directory to your machine. This can go anywhere on your machine; for example, you might put it in d:\classes\cs342\homework on a Windows machine. We provide a zip file containing all of the homeworks and their tests. You need to edit the path to the homework directory that this file contains into your copy of the course library's localize.scm file.

Return to top

Working with our Test Drivers

The test drivers in the test-homework.scm file are loaded automatically. By default they do not show output of tests that are passing. If you want to see more output, execute (show-test-output!); to see less output, execute (hide-test-output!).

Return to top

Other Ways to use the Library

The following describe other ways to use the library that most students can ignore. These may be useful for special purposes or for students using other Scheme systems besides DrScheme.

DrScheme Teachpack for the Course

You can ignore the teachpack if you use the Typedscm language in DrScheme (or if you use Chez Scheme). The Typedscm language is preferable as it allows you to write type declarations inside modules.

You would only need to use the teachpack if you want to use the MzScheme language directly, instead of using the Typedscm language. Note that there is no need to use both the Typedscm language selection and the teachpack. So, if you use the teachpack, you should use the MzScheme language in DrScheme. But if you select the "Typedscm" language from the language menu, you can skip using the teachpack completely.

To use the teachpack is done from DrScheme's language menu. First select the MzScheme language using the "Choose Language ..." option. This language appears under the PLT languages; you have to select the right-pointing triangle if it doesn't appear there.

Then, from the Language menu, select "Add teachpack...". From the file selection dialog that appears, navigate upwards one level, then down to the collects directory, and then down to the lib342 directory. Finally in that directory select the file drscheme-eopl-teachpack.scm.

Now, push the "Run" button to restart the interpreter. You should see that the teachpack is loaded. One way to check this is to type test-hw1 at the prompt, it should show you an output, like #<procedure:...est-homework.scm:9:6>.

Return to top

Scripts for Other Scheme Systems

If are using Chez Scheme instead of DrScheme, you you will need either shell scripts or batch files from $PUB/bin. For example, if you are using the Chez Scheme interpreter, then do whichever of the following applies to you:

Whatever scripts you use, be sure to place them somewhere on your PATH so that they can be found from the command line. On Unix or Mac OS X, be sure that they are also made executable.

Return to top

Last modified Wednesday, March 9, 2005.

This web page is for the Spring 2005 offering of Com S 342 at Iowa State University. The details of this course are subject to change as experience dictates. You will be informed of any changes. Thanks to Curtis Clifton for help with these web pages. Please direct any comments or questions to Gary T. Leavens.