| CSC 153 | Grinnell College | Spring, 2009 |
| Computer Science Fundamentals | ||
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.
When logging into the Campus Linux Network, you will want the system to use the GNOME user interface for your account.
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.
http://www.cs.grinnell.edu/zero-one.xhtml
Examine the course listings on the left to find the home page for this
course.
Close the terminal window by typing <Ctrl/d> at the prompt.
Unless you have done so recently, change your password by typing password in a terminal window and following the prompts that follow.
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.
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.
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.
Experiment with numbers in Scheme.
7
-10
3.1415926535
In each case, note how DrScheme responds.
3/5
-18/19
10/34
How many digits are printed in the answer for rational numbers?
3.1415926535
10.00
-1.414
0.1
(- 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.
(define pi 3.141592)
Now enter pi into Scheme and determine what happens.
(define pi 3.2)
Now what happens if you type the symbol pi?
(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 .
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 31 March 2008 by Henry M. Walker |
|
| For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |