Outside the DrScheme environment

Exercise 1

Copy the square-root program into your home directory by starting a terminal-emulator window and giving the command

cp /home/stone/courses/scheme/examples/square-root-program.ss square-root-program.ss

at the shell prompt. Have MzScheme run your copy by giving the command

mzscheme -r square-root-program.ss

at the shell prompt. What happens if you give the program some value that is not a number? Why?

Exercise 2

Start DrScheme and, in the Definitions window, develop a similar program, iota-program, that prompts the user for a natural number n and outputs the value of (iota n) in the middle of a descriptive, syntactically correct English sentence. Save the completed program in a file named iota-program.ss.

Have MzScheme run your program by giving the command

mzscheme -r iota-program.ss

at the shell prompt.

Run your program under Scheme 48 and account for any differences in its behavior.

Exercise 3

Using the sum-of-inputs procedure that you wrote as a solution to exercise 4 of the lab on input and output procedures, write a calculator program that takes as many numbers as the user types in and returns their sum.

Exercise 4

It is also possible to run the MzScheme processor without giving it a program to run, just by typing

mzscheme

by itself at the shell prompt. What does MzScheme do when it has no program to follow? Could this behavior ever be useful?

(Incidentally, you can shut down MzScheme by pressing <Control/D>.)


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~stone/courses/scheme/labs/outside-drscheme.xhtml

created March 5, 2000
last revised August 22, 2001

John David Stone (stone@cs.grinnell.edu) Ben Gum (gum@cs.grinnell.edu)