CSC 153 Grinnell College Spring, 2009
 
Computer Science Fundamentals
 

Getting Started

Goals

The following sections of this lab provide practice with material discussed in the reading for this laboratory exercise.

As noted in the reading, you may already be familiar with some of the mechanics given here, since you have already programmed in some language on some computer system. However, you should work through these steps completely (even if quickly) to be sure there are no surprises. When you get to the material in Scheme, be sure you understand each result before going on.


Logging In and Out

When logging into the Campus Linux Network, you will want the system to use the GNOME user interface for your account.

  1. You should follow these steps the first time you log in.


Mozilla Firefox

Once logged in, you should open the Mozilla Firefox browser.

Note that details for the following outline are given in the reading for this laboratory exercise.

  1. Open the Mozilla Foxfire browser by clicking on the Foxfire icon (the picture with the circular picture of the world at the bottom panel of the screen).

  2. If this is your first time running Mozilla Foxfire on the Campus Linux Network, you may encounter two message boxes, asking your consent to the Firefox licensing agreement and requesting permission to create some configuration files in your home directory. You should approve both of these requests by clicking on the appropriate response box.

  3. Initially, Foxfire should show this department's Zero-One page:
         http://www.cs.grinnell.edu/zero-one.xhtml
    
    Examine the course listings on the left to find the home page for this course.

  4. Use the Bookmarks option at the top of the browser to Bookmark This Page for future reference.


The Terminal Window

  1. After logging in, open a terminal window by moving the mouse onto the small monitor icon on the bottom row of the front panel, and clicking with the left mouse button.

    Close the terminal window by typing <Ctrl/d> at the prompt.

Changing Your Password

  1. Unless you have done so recently, change your password by typing password in a terminal window and following the prompts that follow.


Running Scheme:

  1. Run Scheme by clicking on the red, white, and blue lambda-in-a-circle icon on the bottom front panel. This will open a new window that runs the DrScheme environment.

  2. Set DrScheme to the "Graphical" dialect of Scheme, following directions for running scheme with DrScheme from the reading.

    Be sure that DrScheme is set to "Graphical (MrEd, includes MzScheme)", since this dialect of Scheme is closest to the national Scheme standard.

    Ask your instructor, if you have questions about what Scheme dialect is being used in your DrScheme environment.

  3. With the Scheme dialect set to "Graphical (MrEd, includes MzScheme)", click on the "Execute" button near the top of the DrScheme environment.

    You can now type Scheme commands in the large window at the bottom half of DrScheme.


Working within Scheme

Experiment with numbers in Scheme.

  1. Integers: At the Scheme prompt, type several integers, such as
        7
        -10
        3.1415926535
    
    In each case, note how DrScheme responds.

  2. Fractions: Determine what happens when you enter a fraction. For example, what value is returned when you enter:
        3/5
        -18/19
        10/34
    
    How many digits are printed in the answer for rational numbers?

  3. Enter several real or floating point numbers, such as
        3.1415926535
        10.00
        -1.414
        0.1
    

  4. Accuracy: Enter several numbers with many digits. How many digits are printed in the answer for integers? For reals?

  5. Numeric Procedures: In Scheme, all operation names are listed as the first component within the parentheses, so (f x) is typed to represent the functional value f(x). Observe what happens when you type the following operations into Scheme:
        (- 27 3)
        (/ 17 2)
        (/ 17 -2)
        (/ 17 2.0)
        (truncate (/ 17 4))
        (modulo 17 3)
        (sqrt 4)
        (sin 0.5)
        (sqrt -2)
        (+ (* 3 2) (/ 8 4))
    

    Do any of your results from these experiments suggest other types of numbers that are available within Scheme (beyond integers, rational numbers, and floating-point numbers)? Explain briefly.

  6. Symbols: Consider the symbols TwoBeOrNot2Be and This-is-a-symbol. Describe what happens when you type one of the above symbols into Scheme.

  7. Give the symbol pi the value 3.141592 as follows:
         (define pi 3.141592)
    
    Now enter pi into Scheme and determine what happens.

  8. Check if work with symbols within DrScheme is case sensitive. What happens if you type Pi or PI.

  9. Check whether Scheme allows you to redefine the value of a symbol. For example, the 1897 Indiana House came close to declaring that the value of pi is about 3.2:
         (define pi 3.2)
    
    Now what happens if you type the symbol pi?

  10. Determine what happens if you make a typographical error. For example, try misspelling define or leaving out a left or right parentheses. In each case, make a note describing what happens.

  11. Binding: Consider the following sequence of definitions:
       (define a 4)
       (define b 5)
       (define c 1)
       (define discriminant 
             (- (* b b) (* 4 (* a c))))
       (define root1
             (/ (+ (- b) (sqrt discriminant))
                (* 2 a)))
       (define root2
             (/ (- (- b) (sqrt discriminant))
                (* 2 a)))
    
    Determine the values for a, b, c, discriminant, root1, and root2 .

  12. Continue the previous problem by changing the values of a, b, and c. Are the values of discriminant, root1 and root2 changed immediately, or do these symbols have their earlier values?


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~walker/courses/153.sp09/labs/lab-getting-started.shtml

created 29 December 1996 by John David Stone
last revised 18 January 2009 by Henry M. Walker
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.