Recall that the syntax of scan forms is
Scanners are defined using the top-level function, define-scanner. It compiles the scanner's code through the first two stages of the compiler and caches the result.
When compiling code that uses scan, step 2 checks the user-level syntax of the form, verifying that the specified scanner is known. It supplies a default scanner (no-order-scan) if the scanner is omitted, as necessary. If the scan form contains more than one inside expression, they are packaged into a begin form, so that the output scan form always has two inputs.
Step 3, which renames variables to make them unique, must process the test and the expressions inside the loop in an environment in which variable is bound. The incoming sample-or-sheet argument is processed in an environment in which variable is not bound. The scanner itself is ignored. Step 4 (pre-type rewriting rules) processes the inner code and test but leaves the scanner itself untouched.
Step 5a checks typing within the scan form (except for the scanner itself) and determines the type of the sample-or-sheet object. It also completes the rewriting process. It must
Ownership, Maintenance and Disclaimers
Manual Top Page