CSC 153: Computer Science Fundamentals Grinnell College Spring, 2005
Laboratory Exercise Reading

Getting Started


This reading reviews some mechanics related to the use of the Mathematics Local-Area Network (MathLAN) for CS 153. The lab also introduces the Scheme environment and introduces Scheme's read-eval-print loop.

More specifically, this lab discusses:

Since you have already programmed in some language on some computer system, some of these mechanics may already be familiar. However, at the very least, you should skim through the first several sections to be sure there are no surprises.

Please pay particular attention to the sections on Scheme and its history.

Logging In and Out

To use any of the computers in the Mathematics Local-Area Network (MathLAN), one must log in, giving a user name and a password. Contact the instructor if you have questions about this process.

MathLAN computers run the Debian Linux operating system, since this environment provides especially good support for activities related to computer science and mathematics. Debian Linux provides several user interfaces, programs through which one manages various programs and resources that the workstation can access. The recommended user interface is called GNOME. In most cases, GNOME will come up automatically when you log in.

To ensure that the system will use GNOME for your account,

Note: It is not necessary to turn off the workstation when you are finished. MathLAN workstations are designed to operate continuously; turning them off and on frequently actually shortens their life expectancy.

Mozilla Firefox

Many materials for this course will be distributed over the World Wide Web rather than in paper copies. To view materials, such as this course's syllabus and this lab, you may follow these steps:

  1. Prepare to utilize the World Wide Web by clicking on the Firefox icon (the circular picture of the world at the bottom panel of the screen).

  2. The first time you run Mozilla FoxFire on MathLAN, two message boxes may pop up.
    1. One box asks you to consent to the terms of Firefox's licensing agreement;
    2. One box requests permission to create some configuration files in your home directory.
    You should approve both of these requests by clicking on the appropriate word. The pop-up boxes then disappear; you won't see them on subsequent uses of Mozilla Firefox.

  3. Initially, Firefox displays a World Wide Web document entitled ``The origin,'' which is an entry point to Web site of the Department of Mathematics and Computer Science. In the left-hand column of this document, under the heading ``Course front doors,'' you'll see the underlined listing ``CSC 153: Computer Science Fundamentals (Mr. Walker).'' Move the mouse to this listing and click the left mouse button. ``The origin'' is replaced with the document entitled ``CSC 153: Computer Science Fundamentals.''


Because URLs are notoriously hard to remember and to type accurately, Firefox allows you to place a bookmark on any interesting or important document that you reach. To place a bookmark on the document currently displayed, move the mouse onto the word Bookmarks above the main display window, click the left mouse button to bring up the corresponding menu, and select the Bookmark This Page... operation. A new window, with the title ``Add Bookmark'' will appear. Move the mouse onto the button marked Add in the new window and click the left mouse button. You can subsequently return to that document by bringing up the Bookmarks menu again and selecting from it the title of the document.

For instance, I recommend that you bookmark the front-door page for this course, so that you can return to it easily, no matter what document is currently displayed.

The Terminal Window

MathLAN supports several Scheme programming environments. For example, Dr. Scheme may be accessed through the red and blue icon containing the Greek letter lambda, located at the bottom of your workstation's window. Although this system is commonly used at Grinnell, it adds some overhead for this course, and the overhead of learning this system arguably outweighs its advantages. Thus, while you are welcome to experiment with Dr. Scheme, this is not the recommended environment for use in this course.

Rather, the Scheme system that recommended for this course is not represented by any icon on the front panel. To run it, one must invoke it by name. The computer program that reads and responds to such invocations is called the shell, and one's interactions with the shell take place in a window generated by a program called a terminal emulator.

You may already have a terminal window on screen. If not, you can start one at any time by moving the pointer onto the small monitor icon on the bottom row of the front panel, and click with the left mouse button. Shortly a window will appear, displaying the shell prompt -- the name of the workstation on which the shell is running, followed by a percentage sign. This prompt indicates that the shell is ready to receive instructions.

One enters such instructions using the keyboard. Move the mouse pointer into the terminal window to make it active. (You many need to click on the window, once your mouse is in the desired area.) The window frame changes color, indicating that the window has become active.

To shut down terminal, press <Ctrl/d> -- that is, hold down either of the keys marked <Ctrl>, just below the <Shift> keys, and simultaneously press the <d> key. (On our workstations' keyboards, the keys marked <Ctrl> (``control'') and <Alt> (``alt'' or ``meta'') are somewhat like <Shift> keys, in the sense that they modify the effect of other keys that are pressed simultaneously.) The shell program interprets <Ctrl/d> as a signal that you have no more instructions for it and halts, and the terminal terminal emulator closes the window automatically once the shell stops running.

If you want to set the window aside for the moment, with the possibility of returning to it later, look closely at the upper right-hand corner of the window, where the frame contains a small bar or underscore character; if you move the pointer into that square and click on the left mouse button, you minimize the window, closing it up into a small rectangular icon along the bottom control panel on the screen. A minimized window can be restored by moving the pointer onto its icon and clicking the left mouse button twice in rapid succession.

Changing Your Password

You should change the password associated with your account shortly after you receive it and every few months thereafter. The password program lets you make this change.

  1. Choose a new password. Make it something that you can easily remember, but not an English word or a name, since it is easy for system crackers to break in by guessing your password if you choose it from one of those categories.

  2. Open a terminal window, move the pointer into it, and type the word password. The password program will prompt you once for your old password -- the one you logged in with -- and twice for your new password. If you give your old password correctly and the two copies of your new password match, the program will substitute the new password for the old one in the table that the login program consults. The old password will be discarded and will not be recognized in subsequent logins. (If the attempt to change the password fails for any reason, however, the old password will be retained.)

After running the password program, the shell takes over again and issues another prompt. You can invoke as many programs as you like from the shell, one after another, before pressing <Ctrl/d> to leave the shell.

Notes on the History of Scheme:

Lisp was invented in the late 1950's and early 1960's at M.I.T. by John McCarthy. Lisp is based in part on the Lambda Calculus, a mathematical formalism developed by Alonzo Church (1903-1995).

Lisp is the second-oldest language still in widespread use (the oldest is FORTRAN). Two dialects of Lisp are widely used today: Scheme and Common Lisp. Scheme is a small, uniform dialect that is good for teaching because of its simplicity. Common Lisp is a large, ``industrial-strength'' dialect that is standardized and is available in several commercial versions. In this course, we will use an implementation of Scheme called Petit Chez Scheme .

Most programming languages require learning the syntax of many different kinds of statements. In contrast, Scheme (and Lisp) syntax is simple and uniform. Much of the work in learning Scheme is learning the names and effects of the system functions that form the core of the language. This course presents the system functions and covers other functions that are present in Common Lisp.

Lisp is especially used for work in Artificial Intelligence. For example, CS 261, Artificial Intelligence, uses programming in LISP in its study of expert systems.

Running Scheme:

To run the Scheme system, move the pointer into the terminal window, type the word scheme (all in lower-case letters), and press the <Enter> key. Scheme will print out a header and then issue its own prompt (a greater-than sign), indicating that it is ready to examine and process any Scheme program that you submit to it:

Petite Chez Scheme Version 6.0a
Copyright (c) 1998 Cadence Research Systems


To shut down Scheme, press <Ctrl/d> at the Scheme prompt. The shell comes back and generates another prompt once Scheme has stopped.

Working within Scheme

  1. In Scheme, processing proceeds by typing expressions into the Scheme environment. After each expression is entered, Scheme

    This read-eval-print cycle forms the basis for all processing within Scheme.

    For example, if we type (sqrt 1024) into Scheme, the environment identifies sqrt as an operation to be applied to the number 1024. The computer then evaluates this expression, and concludes by printing the number 32 at the end.

  2. Numbers are expressions, whose value or meaning is the number itself. Scheme recognizes several types of numbers, including the following:

  3. Numeric Procedures: As illustrated above, in Scheme we apply operations to data using a prefix notation with parentheses. For example, the function f(x) would be written (f x). Some common numeric operations follow.
        (+ 27 3.1415926535)
        (- 27 3)
        (/ 17 2)
        (/ 17 -2)
        (* 17 2.0)
        (sqrt 4)
        (sin 0.5)
        (sqrt -2)
        (+ (* 3 2) (/ 8 4))

  4. Symbols are Scheme's analog of words; symbols are sequences of characters, such as

    In Scheme, symbols may act as variable names, but they do not have a value until we give them one.

  5. Binding: We may give a symbol a value using a define operation. For example, we might give the symbol pi the value 3.141592 as follows:

         (define pi 3.141592)

    Similarly, we can give the symbol radical-2 the value of the square root of two as follows:

         (define radical-2 (sqrt 2))

    When using define, the symbol is given the current value of the expression that follows.

This document is available on the World Wide Web as

created December 29, 1996 by John David Stone
last revised January 23, 2005 by Henry M. Walker
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at