198:314
Principles of Programming Languages
Fall 2003

Using DrScheme



If you are working on your personal machine, DrScheme is a reasonable choice. If you're getting funny errors from DrScheme when using scheme, it might be that you need to set your language (see below).

Installing DrScheme

  1. Download the appropriate version of DrScheme from here (it's available for Windows, Mac and Unix), and follow the installation instructions. You don't need any of the other packages that are available -- just DrScheme. It will ask you a few questions, most of the answers are obvious.
  2. You might be asked to compile (or pre-compile) the DrScheme library; you should say yes. It makes everything a lot faster to use.
  3. If you are asked which language you want to use, select Standard (R5RS). (You can change this later, as you'll see below.)
  4. We have successfully installed DrScheme on one of the ARC PCs (to our surprise, we didn't even have to change the default location of the install -- so just use the defaults.) Note that it is promptly removed once you log out! It only takes about 1-2 minutes to install it, so it's not too much of a bother. You can of course still use remus without going through any of this...

Using DrScheme

  1. Run DrScheme -- you'll see a window split in two. The top is the editor, the bottom is the read-eval-print loop. Anything that you want to keep should be written in the top window. The bottom window regularly gets cleared out during normal use.
  2. In the Language menu, select Choose Language.... In the list you will want to select Standard (R5RS) -- this is the version of scheme that corresponds best to what is on remus.
  3. Note that there are a number of "simplified" versions of scheme. (In fact, the default was one of them, before you changed it.) Many features of scheme are simply not available in those languages.
  4. Whenever you hit "Evaluate", the contents of the top buffer are evaluated, and the results are available in the bottom (the read-eval-print loop). Note that the contents of the bottom are cleared whenever this happens (this is why you should use the top window for editing your program!).
  5. The "Step" button is useful for learning scheme, and seeing how the evaluation process takes place. Before doing this, you need to set the language to Intermediate Student with Lambda (which is inside the "How to Design Programs" tab in the "Choose Language..." menu item, as the step feature is not available in all languages. Put everything you want to step through (including an example evaluation) in the top window, and hit "Step". For example, try the following:
        (define (len l) (if (null? l) 0 (+ 1 (len (cdr l)))))
        (len '(3 1 4))
  6. Apparently The "Intermediate Student" language defines foldr and foldl, and doesn't let you redefine it. You might want to name your functions foldright and foldleft for doing tracing examples. Also note that if you have a () in your code in this reduced version of the language, you need to quote it like this: '()
  7. DrScheme remembers which language you used last time, so make sure you switch back to R5RS when doing your homework.
  8. The online documentation is quite helpful.

Known differences between scm on remus and DrScheme:

(Note that it's still up to you to make sure your program works on remus!)

Last updated at 7:00 pm on February 4, 2004 by D. DeCarlo.