Always Use let

Nearly every function (unless it is very small) should begin with a let:

(define (myfun args )
      (let ( (var_1 value_1 ) ... )
      code ))

Rule: Every local variable used in a function must be declared, i.e., must be either an argument of the function or a let variable.

Declaring let variables is similar to a var declaration in Pascal.

If you fail to declare a let variable, the variable is treated as a global variable. This is a dangerous practice that will be penalized in grading.

Contents    Page-10    Prev    Next    Page+10    Index