================================================================== This is the beginning of Hunk B. ==================================================================
Most Scheme implementations are interactive. The Scheme system is just a program with a command interpreter. When it starts up, it presents you with a prompt, letting you type in an expression. The Scheme system "interprets" that expression, and does what it says to do. Then it prints out a textual representation of the result of the expression.
(Your Scheme system may have a graphical user interface, but the basic idea is the same--you tell Scheme what to do, and it obediently does it, tells you what happened, and asks for the next command. With a GUI, you may be able to tell Scheme what to do by clicking on buttons, etc.)
This is very similar to an operating system's command interpreter or "shell." A shell is just an interpreter for a language--usually a really ugly language.
The nice thing about an interactive programming environment is that your program doesn't go away after you run it. You're "inside" the program, and you can tell it what to do, but instead of just running to completion, it comes back and asks you what to do next.
The values of variables are still around, and you can look at them if you want to. This makes it easy to debug a program. You can type in definitions of variables and procedures, and then run a procedure and see if it does what you expect. If not, you can redefine it. In effect, you're inside your program, and the Scheme system acts as a dispatcher, executing whatever part you want and letting you examine the results. This makes it easy to build and test your program in small pieces, and gradually build up larger and larger pieces that use those pieces.
In this section, we'll go through a simple example session with Scheme, fairly slowly, starting with examples similar to the ones in the previous chapter. I'll assume Scheme is already properly installed on your system. If it's not, you need to get Scheme and install it, or have someone install it for you.
(Plug: you might want to use our Scheme, RScheme, which is free. There are other implementations of Scheme of course, including commercial products and other free implementations. If you're using a different Scheme, its operation should be very similar--see the manual for your system.)
It's a very good idea to follow along with this text in front of a running Scheme system, so that you get used to using it interactively. I'll assume you are doing this, and say "do this" and "do that." You don't have to do it, of course, but it's the best way to learn Scheme.