Using DrScheme with 6.034
DrScheme is an open-source integrated development environment (IDE) for Scheme maintained by the PLT group. Although DrScheme is available also on Linux, there are subtle differences in file placement and path issues and MIT/GNU Scheme is available on these platforms. We are therefore not currently supporting PLT DrScheme for Linux.Warnings
First, our support for DrScheme is highly experimental. This is the first time DrScheme is being used in the curriculum. As a result, we recommend that, if at all possible, you use MIT Scheme instead, as described on the main Resources page. You can run MIT Scheme from any Linux-Athena or machine, such as those available in any of the clusters around campus, or a Windows machine. Please e-mail the 6.034 staff if you encounter problems using DrScheme so we can work out the bugs.
DrScheme's variants of scheme are not the same as MITScheme dialect, which what we officially support in this course. Due to the unavailability of a MIT/GNU scheme interpreter on non-Intel architectures, however, we are providing experimental DrScheme support.
On another note, we recommend AGAINST running scheme remotely via ssh/X-forwarding on public dialups, as public dialups are not for use for compute-intensive processses. Your scheme projects will likely often be very compute-intensive.
Setting up DrScheme
Step 1: Download and install DrScheme
The first thing you need to do is download the binary build of DrScheme and run the installer. It should be similar to installing any other familiar software applications.
Download: DrScheme (Current version 301)
Step 2: Add 6.034 extension libraries to DrScheme
The Scheme dialects used by DrScheme (r5rs/mzscheme) lack many of the familiar primitives in MIT Scheme. In order to make our example code run on DrScheme, we have provided a set of compatibility libraries that make some of the commonly-used MITScheme definitions available in DrScheme. We have provided these in a tarball linked below.
To download this file, right-click on the following link and select Download linked file or Save Target As.. to make sure your browser does not automatically unzip/untar the file. Have your browser save the file to your Desktop.
Windows
Download: drscheme_6034lib.zip (Current version 2.14)
After you have downloaded this file, unzip\untar it into the base PLT Scheme v301 directory. This directory is usually located in C:\Program Files\PLT, but may be in a different place if you chose a different target location during the installation.
Mac OS X
Download: drscheme_6034lib.tar.gz (Current version 2.14)
After you have downloaded this file, untar it into your PLT Scheme v301 directory (usually located in /Applications/PLT Scheme v301) as follows :
In a Terminal, type:
emax$ cd /Applications/PLT\ Scheme\ v301/ emax$ sudo tar xzvf ~/Desktop/drscheme_6034lib_2.14.tar.gzWarning: Note that latter command uses sudo because it needs root access to write to the /Applications/PLT\ Scheme\ v301/ directory. Please be careful to write the command carefully as shown above.
After this is done you can delete the original drscheme_6034lib.* file from your Desktop.
Step 3: Choosing a Language
The final thing you need to do is run DrScheme and load the provided 6.034 libraries. Launch DrScheme by double-clicking the DrScheme application icon in PLT Scheme v301 in Finder. Then, open a new IDE window by going to File->New (or using command-N). Change the Scheme language of this window to Pretty Big, by going to Language menu, selecting Choose Language and selecting "Pretty Big" under the PLT group.
When you have "Pretty Big" selected, press Show Details at the bottom of the dialog box. This will reveal an expanded panel for language options; look for Input Syntax and make sure "Case sensitive" is unselected.
Then hit Ok and press the Run button in your open windows to commit your changes.
Step 4: Load compatibility libraries
Prior to running any 6.034-specific code, you should load the 6.034 compatibility libraries we provided. To do so, type at the Read-Eval Print Loop :> (require (lib "init.ss" "6.034"))
Note than every time you restart your DrScheme interpreter (such as by hitting Run, or opening a new interpreter window, or quitting/restarting DrScheme) you will have to re-execute the above require command to load the 6.034 extension libraries. So, you may find it convenient to add the (require (lib "init.ss" .. to the top of your load/run files.
Step 5: Run your code!
Then you're all set! You can check that everything went OK by verifying the existence of a sort method in your environment, such as:
> sort #<procedure:sort>
Finding Documentation
Most of the documentation for DrScheme is available on the PLT Scheme web site, including the MzScheme Language Manual.Questions/comments?
As usual, please contact 6034sp-staff@csail.mit.edu if you have any problems or suggestions!
Examples of Miscellanous Useful Scheme Stuff
Functions
(current-directory "/mit/6.034/ps1")Changes the working directory.
(current-directory)
Print the working directory.
(load "match.scm")
Loads and evaluates contents of a file (here, match.scm).
(require (lib "trace.ss"))
(trace func)
Shows the input arguments and output value when the function is called. Redefining the function, such as by loading a file that defines it, undoes the tracing.(untrace) will also remove tracing.
You may find a more comfortable general-purpose display function to be:
(define disp (lambda args (letrec ((disp-in (lambda (arg) (if (null? arg) 'Done (begin (display (car arg)) (disp-in (cdr arg))))))) (disp-in args))))
which will allow you to do things such as:
(define foo 42) (disp "The answer is " foo " nodes.")
and get:
The answer is 42 nodes.