Getting started with MIT Scheme

This page provides information and tips on running MIT Scheme, as well as a few general Scheme references:

If you are having trouble getting MIT Scheme to run on your computer or with accessing MIT Scheme through CS or RCS machines, please try emailing Adam Goode (goodea@rpi.edu) first.

Here are a few handy links:

whuang@cs.rpi.edu; email
Last updates: September 1; August 30, 2000; August 29, 2000


MIT Scheme on RCS

ACS has installed MIT Scheme 7.5 (for Windows) in /campus/lang/scheme/7.5/win32. I was told that the CIS public NT PC labs will have shortcuts to MIT Scheme on the Start menu starting on Wednesday August 30, but this was not the case the last time I checked. You can, however, start Scheme manually. (You could make batch files with the proper commands also.)

But first, you must map \\sambasrv\public to the P: drive. To do this, double click on the RCS File and Print Sharing icon. From other systems, right click on My Computer and select Map Network Drive... Then, map \\sambasrv\public as the P: drive. In order to access sambasrv, plain text passwords must be enabled.

If the shortcuts on the Start menu don't work, you can start edwin by running:

p:\campus\lang\scheme\7.5\win32\bin\scheme -band p:\campus\lang\scheme\7.5\win32\lib\edwin.com -edit

(This should all be on one line.) You can do this from the "Run" command on the Start menu or (I think) from a MSDOS window.

It's possible that running over the network through sambasrv will be slow. When I tried, it took maybe 10 seconds or so to load.

MIT Scheme on CS machines

You should all now have CS accounts, so you can run MIT Scheme (version 7.3) on the Solaris 8 Suns in the CS department. By the way, the passwords I passed out in class are your new Kerberos passwords.

The preferred way to access the CS department machines is to use "ssh" to connect to remote.cs.rpi.edu which will route you to a machine. You could also go to the SPARC lab in Amos Eaton 217, but this is discouraged because it will be a crowded lab this semester.

Edwin will not run off the CS machines for some reason, so you should run Scheme as an inferior process of emacs or xemacs.

Getting MIT Scheme

MIT Scheme is freeware; you can download the latest version from the the MIT Scheme Release 7.5 home page. It is available for Intel-architecture (x86) machines running GNU/Linux, FreeBSD, IBM OS/2 or Microsoft Windows 9x/NT/2000. Follow the installation instructions in Chapter 1 of the User's manual. You can also get the Windows distribution in the RCS directory /campus/lang/scheme/7.5/distrib.

Although there are other implementations of Scheme that are freely available, I strongly recommend that you find a way to run MIT Scheme. In programming assignments later in the semester, we may incorporate some graphics, and this code will be specific to MIT Scheme.

For Sun SPARC (and some other UNIX hardware platforms), the most recent version available is version 7.3. Code that runs under version 7.3 should work fine under version 7.5, but it would be better if you used version 7.5.

I'm afraid Mac users are out of luck... There is no current version of MIT Scheme that runs on a Mac.

Notes on Installation

MIT Scheme is moderately large; the Linux version tarball is almost 18 Mb; the Windows distribution is about 24 Mb. They both expand to about 40 Mb. You can save some space by doing the following:

That should clear up about 13 Mb. If you don't end up using Edwin, you can get rid of edwin.com and SRC/edwin which should free up another 10 Mb. It's possible that you can get rid of the entire SRC directory; it mostly contains files for debugging. I'm not yet certain whether you'll want to have these or not.

Also note that MIT Scheme comes with a copy of the User's manual and the Reference manual.

Running MIT Scheme

There are three basic ways you can run MIT Scheme (in order of my recommendation):

  1. Run Edwin, the emacs-like editor that comes with MIT Scheme.
  2. Run MIT Scheme as an inferior process under gnu-emacs or xemacs. (This option is not available under Windows.)
  3. Run MIT Scheme standalone.

I recommend the first option, using Edwin, marginally over the second because it has better support for the debugger.

There are three reasons that you might take the second option, running MIT Scheme as an inferior process under emacs:

Gnu-emacs and xemacs, however, do not have all the features of Edwin when it comes to using the Scheme debugger. The underlying debugger is the same, but is easier to use in Edwin. Also, there is a special debugger, the stepper which is available in Edwin but not in Emacs.

If you prefer emacs, you could use it most of the time and run Edwin only when you wanted to use its debugging interface.

I do not recommend running MIT Scheme standalone because you have no command line editing. And besides, I strongly recommend using emacs or Edwin to write your code, so why not run scheme via one of these methods?

Running Edwin

Windows users actually have it easy: they can simply use the shortcuts in the Start menu. In UNIX, you need to give the command:

scheme -edwin -edit
On my computer, I have aliased edwin to the above command.

To get the Edwin tutorial, type "C-h i" (i.e. control-h followed by the letter "i"). To exit Edwin, type "C-x C-c". For more information on using Edwin:

One customization that I recommend for Edwin is creating a .edwin file that contains the following line: (define-key 'scheme #\m-q 'fill-paragraph) This will bind the M-q to the fill-paragraph command. This is useful for reflowing your comments into proper paragraphs. It knows about the Scheme comment character (a semicolon) and can deal with multiple comment characters (i.e. three semicolons at the beginning of a line to start comments).

Running Scheme under emacs

If you want to run Scheme as an inferior process in gnu-emacs or xemacs (this is not an option on Windows machines), then you'll need to download either the xscheme.el or xscheme.elc files. These are on the the MIT Scheme Release 7.5 home page under "Emacs." You'll have to put them in the appropriate place on your system. On my RedHat Linux system, this is in /usr/share/emacs/20.5/lisp.

You can either do a M-x load-library and type xscheme at the prompt, or you can add the following line to your .emacs file: (load-library "xscheme") Then, the command M-x run-scheme will bring up a Scheme interaction buffer with an inferior Scheme process. For more information on using MIT Scheme with emacs:

Running Scheme standalone

You can run scheme all by itself, write your code in some editor (preferrably emacs), and then load your code via the command:
(load "filename.scm")
But again, I don't recommend this option.

Top 10 keybindings in Edwin/Emacs for MIT Scheme

These are keybindings specific to using MIT Scheme. I STRONGLY recommend that you spend some time learning how to use the emacs editor itself, i.e. learn the basic keybindings for moving the cursor around, switching buffers, killing and yanking text, etc. The time you spend will be more than repaid in your productivity.

  1. TAB properly indents your scheme code

    Type a line of code. Hit return. Hit TAB. Type the next line of code. Repeat.

    OR, put the cursor an any point on a line of improperly indented code. Hit TAB, and the line will be indented the proper amount (relative to the lines above it, so start at the top if you need to do multiple lines, or use C-M-q).

  2. C-x C-e sends the expression to the left of the cursor. This works both in the Scheme interaction buffer as well as in scheme-mode buffers where you are editing your code.

    This command looks left from the cursor until it has a complete expression and then sends that to the Scheme interpreter.

  3. M-z sends the current expression to the Scheme interpreter. This works both in the Scheme interaction buffer as well as in scheme-mode buffers where you are editing your code.

    This command looks for an open parenthesis in the leftmost column and sends all the text from there up to the cursor position, and then to the right of the cursor until all parentheses are balanced.

  4. C-c C-s when done in a scheme-mode buffer, will switch to the Scheme interaction buffer.

  5. M-p and M-n in the Scheme interaction buffer will scroll through the history of expressions that you have sent to the Scheme interpreter. (This doesn't work if you are using version 7.3. You can use C-c C-y to yank the previous command.)

  6. C-c C-c sends an interrupt to the Scheme interpreter.

  7. C-M-a and C-M-e move the cursor to the beginning and end of a definition, respectively.

    Your code should be indented properly for these to have the desired effect.

  8. C-M-p and C-M-n move the cursor over the previous and next (respectively) parenthesis balanced list.

  9. M-o from a scheme-mode buffer, will send the entire buffer to the Scheme interpreter.

  10. C-M-q properly indents an entire definition.

    The cursor should be on the opening parenthesis of the define for this to work properly.