Note: Each member of your group should do this lab working within his or her own account.
Many of the fundamental ideas of computer science are best learned by reading, writing, and executing small computer programs that illustrate them. One of our most important tools, therefore, is a computer program designed specifically to make it easier to read, write, and execute other computer programs. In this class, we will often use a programming environment named DrScheme.
PLTso that it points down.
To start DrScheme, click the mouse on the large, round, red icon
containing the Greek letter lambda in the middle of the control panel.
(If you don't have the lambda, you can open a terminal window and type
The first time you start DrScheme, it will ask you what human language you'd
like to use. For this class, you should probably select
with DrScheme in English.
DrScheme will also ask you what version of Scheme (which it also calls
language) to use. We explore a lot of Scheme in this course, so
we'd like you to use one of the biggest versions, Graphical Scheme.
To select that version, you first need to expand the list under
PLT, which you can do by clicking on the triangle
PLT so that it points down. You can then
Graphical (MrEd, includes MzScheme).
Once you've selected a version of Scheme, click on thebutton.
Shortly, DrScheme will start up and appear as a new window, with two white rectangular text areas against a dark gray background.
At the top of the window, just below the frame, is a menu bar, providing ways of activating various operations that DrScheme can perform. Eventually we'll explore a number of these, but for the moment let's just look at one that you're certain to need: the operation of shutting itself down.
Move the mouse pointer onto the wordat the left end of the menu bar and click the left mouse button. A small menu appears.
Move the mouse pointer onto the wordat the bottom of this menu and click the left mouse button. DrScheme responds by popping up a confirmation box of its own, the purpose of which is to make sure that you don't shut down DrScheme by mistake.
Move the mouse pointer onto the wordin the confirmation box and click the left mouse button. Both the confirmation box and the main DrScheme window disappear.
PLTso that it points down
Some people mistakenly choose the wrong version of Scheme to use. These instructions will help you choose the appropriate version.
DrScheme can deal with computer programs written in any of a number of dialects of the Scheme programming language. When you start it up for the first time, it expects you to use Beginning Student Scheme, which is a kind of training-wheels dialect that enables DrScheme to catch and diagnose some common mistakes of novice programmers.
Since we want to use consistent materials and language throughout the
semester, we're going to proceed directly to
Full Scheme, which
is more nearly standard. To inform DrScheme of this decision, we'll
need another of the operations accessed through the menu bar. If you
exited from DrScheme, restart it now. When the window appears, move the
mouse pointer onto the word on the menu bar
and click the left mouse button to bring up the Language menu. Move the
mouse pointer onto the phrase
and click the left mouse button again to select that operation.
Another window appears.
Move the mouse pointer over the triangle to the left of
and click on it until it points downward. You should see a few more words
indented. Click on
Graphical (MrEd, includes MzScheme).
Move the mouse pointer onto the word
Graphical Full Scheme.
DrScheme retains the information that you prefer to use full Scheme, so that when you log in again tomorrow and start DrScheme again, it will automatically expect programs in that dialect. You won't need to use theoperation again unless you decide that you'd like to experiment with Beginning Student Scheme or some other dialect.
Make sure that all members of your group log in and choose the appropriate dialect of Scheme before you go on to do any other work in Scheme.
Now you're ready to look at the parts of DrScheme.
In the interactions pane -- the lower of the two large text areas -- DrScheme displays a one-line greeting, a reminder of which dialect of Scheme it expects to see, and a prompt (in this case, a greater-than sign), indicating that DrScheme is ready to deal with any command that you type in.
To enter a Scheme program, move the mouse pointer to the right of the prompt, click the left mouse button, and type in the program. (If you prefer, you can select the program from another pane by moving the mouse pointer to the beginning of the program, pressing and holding the left mouse button, dragging the mouse pointer to the end of the program, and releasing the left mouse button. The background color against which the text that you have selected changes during this process, so that you can see the boundaries of the selection clearly. You can then paste the selected text into the interactions pane by moving the mouse pointer to the right of the prompt and clicking the middle mouse button.)
To get DrScheme to execute your program, press the <Enter> key after the right parenthesis. At this point, DrScheme examines your program, translates it into a sequence of instructions to the computer's central processor (the electronic circuit that directs the movement and transformation of data inside the computer), executes it, and prints out the result of its computation. Because this particular program is extremely simple, the result is printed immediately.
You may notice that DrScheme prints out another prompt after
executing your program. This is because DrScheme cannot be sure that it
has seen all the steps in the program. A program written in Scheme has a
particularly simple structure: it is a sequence of definitions and commands
-- any number of them, in any order. DrScheme reacts to each definition
that you type into the interactions pane by memorizing it and to each
command by carrying out the command. (The expression
137641) is a command that says
Compute the square root of 137641!)
Because a program might contain several commands rather than just one,
DrScheme has to be prepared to receive another after carrying out the
The upper text area in the DrScheme window, which is called the
definitions pane, is used when you want to prepare a program
off-line, that is, without immediately executing each step.
Instead of processing what you type line by line, DrScheme waits
for you to click on the button labelled
(the second button from the right, in the row just below the menu bar)
before starting to execute the program in the definitions pane.
If you never click on that button, fine -- your program is never executed.
As its name implies, the definitions pane usually contains definitions rather than commands, although either kind of expression can be written in either pane. The difference is simply that we generally want an immediate response to a command, whereas definitions are usually processed in bulk.
Warning: When you click on thebutton, the contents of the interactions pane are erased. The idea is that executing the program in the definitions pane may invalidate the results of previous interactions. Erasing the results that may now be inconsistent with the new definitions ensures that all visible interactions use the same vocabulary. This is actually a helpful feature of DrScheme, but it can take you by surprise the first time you see it happen. Just make sure that you have everything you need from the interactions pane before clicking on .
You can save the contents of either pane in a file at any time by selectingor from the menu. DrScheme pops up a window in which you can specify the name of the file:
Edit the contents of the white text field near the bottom of the pop-up window, adding a slash and the name of the file. Click on thebutton to dismiss the pop-up window.
While we would prefer that you do your work for this class in the
MathLAN so that you have a support network available, it is possible
to run DrScheme on almost any computer, including Macs and PCs
running Microsoft Windows. You can download a copy from
Spring 2000 [John Stone]
Monday, 22 January 2001 [Samuel Rebelsky]
Wednesday, 24 January 2001 [Samuel Rebelksy]
Monday, 2 September 2002 [Samuel A. Rebelsky]
Tuesday, 3 September 2002 [Samuel A. Rebelsky]
Wednesday, 4 September 2002 [Samuel A. Rebelsky]
Tuesday, 21 January 2003 [Samuel A. Rebelsky]
I usually create these pages
on the fly, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 6 09:19:45 2003.
The source to the document was last modified on Tue Jan 21 08:39:17 2003.
This document may be found at