Goal: Learn about ...

Common Sources of (Scheme) Errors

Scheme Error Messages, Part 1

Unbound or unassigned variable
Either a typographical error, or use of a variable outside of the part of the program in which it is available (e.g. using a variable created by let outside the body of the let, or use of a variable created by define within a procedure outside of that procedure).
Applying something that isn't a procedure
"The object ... is not applicable" The value of the first subexpression in a combination must be a procedure.
Wrong number of arguments to a procedure
The number of arguments in a call to a procedure must match the number of parameters the procedure expects.

Scheme Error Messages, Part 2

Wrong type or range of arguments to a primitive procedure
Some primitive procedures require a specific type of argument. For example, the procedure that does addition requires that all of its arguments be numbers, so (+ 3 *) results in the error message "The object #[compiled-procedure ...], passed as the second argument to integer-add, is not the correct type."
Numerical errors (overflow, underflow, divide by zero)
The numerical procedures can fail in a number of ways when dealing with inexact numbers that are either very large, very small, or very close to zero.
Other errors
A number of the procedures built into MIT Scheme can detect special errors and report them. For example, "Unable to open file ... because: no such file or directory."

Debugging Strategy

MIT Scheme Debugging Tools

The Debugger

The Debugger Windows

Two windows in the buffer

Pretty printer

Tracing

Breakpoints

Breakpoints, continued