Play with the insertion, deletion, and cursor-movement operations in the DrScheme Definitions window for a little while, until you feel comfortable with them.
Use the Cut operation to delete everything you've typed, leaving
the definitions window empty.
Type the following Scheme program into the definitions window.
(define area 121) (define square-root sqrt) (define side (square-root area))
The last one is a definition with a procedure call inside it; the effect
is to have DrScheme compute the square root of 121 and define
side as a name for the result.
As you are typing, note that when you type a right parenthesis, DrScheme momentarily moves the cursor back to the matching left parenthesis and grays out the text they enclose. Since longer Scheme definitions often contain many pairs of nested parentheses, this graphic convention makes it much easier to edit Scheme programs.
Save the program in the definitions window in a file named
area-and-side.ss.
Have DrScheme compute the result of dividing 103212 by 732. Then have it divide the same dividend by 564. (Use 〈Esc〉 〈P〉 to copy the preceding command and edit it.)
Exit from DrScheme and restart it. Then invoke the load procedure
to have DrScheme learn the definitions that you saved in area-and-side.ss (in exercise 4). You won't see any immediate response in
the Interactions window, because the file has only definitions in it.
Confirm that DrScheme has memorized the definitions in area-and-side.ss by giving it the following commands, which depend on
those definitions:
(* area 4) (square-root 81) (* side area)
If you get sensible responses in the last step (presumably 484, 9, and 1331, respectively), DrScheme read the definitions correctly. If DrScheme had not seen these definitions, you would have received advisory messages looking like this:
> (* area 4) (bug) reference to undefined identifier: area > (square-root 81) (bug) reference to undefined identifier: square-root > (* side area) (bug) reference to undefined identifier: side
This is how DrScheme reports that it doesn't know the meaning of a name that you've tried to use.
Have DrScheme save the program in the Interactions window in a file
named area-and-side.interactions.
Add appropriate comments to the area-and-side program in your Definitions window and save it again.