The DrScheme Environment

Find SCHEME on the C Drive desktop. (The DrScheme icon is a lambda.) Double-click on the DrScheme icon to open the application. On Unix simply type, drscheme. When the application is first opened, the Interactions window is active by default.

 

The Interactions Window:

This is the window you must use to test all the functions you write in the Definitions window. At first start, it will be blank. As you return to this window after evaluating a function, that function’s name will appear in the Interactions window indicating that Scheme recognizes your declaration of a particular function.

The Interactions window will allow you to:

  1. Write simple procedures i.e. (* 8 3) or (+ 3 4)
  2. Test a procedure you wrote in the Definitions window i.e. (procedure arg1 arg2)
  3. Define things globally i.e. (define x 10)
  4. Write very long, detailed procedures. Yes, you can write any program you might want here, but it is not recommended. Editing becomes very hard and tracing impossible.

Saving: Wait until you are ready to exit scheme and then print your project if needed and save it then. To save a project it is recommended to choose "save other" then "save definition as text" from the file menu, give it a name and save it where you please. Once you leave an active project by quitting the application, there is no way to restore it as an active project. You will only be able to open it for reading. If you save a project via the "save" option from the file menu and want to refer to it later you will have to open it as text (i.e. in a word processing program) or choose "open project" which will only open it as a text document.

Printing: From the Interactions window, you can choose print from the file menu to print a copy of your project.

 

The Definitions window:

This is the window where procedures are written. Everything written in here will be interpreted as Scheme code and will be subject to evaluation, the only legal way to comment something is to use a semi-colon. i.e.

; ; everything here is being ignored..........

And everything else MUST be parenthesized.

You can now write as many procedures as you want in this window.

Note: In this window when you type in a ) to close a statement. The ) as well as the ( that began the statement will flash so you can see what you are closing.

Evaluating: When you have finished writing a procedure and want to test it -- go to the Execute option on the menu bar. If the procedure is the only one in the Definitions window, simply choose "whole document" to evaluate the procedure. To test it, go back to the Interactions window. To toggle between windows, use the "windows" option on the menu bar. This option will display a list of all the windows currently open; select the one you want active. If there are a number of procedures in your Definitions window and you only want to evaluate one or two, highlight the procedures you want to evaluate and choose "selection" from the evaluate menu. As long as these procedures do not call procedures not yet evaluated, all will be well. If changes are made to your programs, you must reevaluate before testing again.

Saving: While in the Definitions window choose "save" from the file menu. The name given by default will be untitled or something similar. Change this name and save the file in the desired location.

Printing: While in the Definitions window choose "print" from the file menu. This will print all the procedures you have been working on.

Loading: To retrieve (from another source) something you are currently working on, either choose "load" from the Evaluate menu or "open" from the file menu.

 

The Stepper Window:

This window allows you to watch as the Scheme Interpreter traces through the execution of your program step by step. Use this for debugging.

After you have defined a function in the Definitions window and executed it at least once, you may to trace it using the "step" option next to the "execute" option. After selecting step, the stepper window will appear and the first line of code will appear followed by a red arrow and the output from the first line of code. To evaluate the next line of code hit next and then the next line of code will appear along with its output.

Saving and Printing: Follow the same procedure described for the Interactions window; once you exit an active stepper window, its state is lost unless it has been saved.

 

The File Menu:

Although saving and printing are the most common options chosen here, you may want to run more than one project or just want a new one -- choose "new project" from the file menu. Use "new" every time you want to open a new Definitions window.

 

The Edit Menu:

Cut, paste, and clear are the most useful for editing.