The let* Construct

let* is similar to let, except that the initializations of local variables are performed in the order specified. This means that the value of a let* variable can be used in computing the value of a subsequent variable.

(let* ( (var_1 value_1 )
...
(var_n value_n ) )
form_1
...
form_n )

The variables var_i are initialized to the values value_i (in order); their values may be changed using set!.

The variables var_i can be accessed by any code that follows their definition.

The value of the let* is the value of form_n.


(define (spool-contents radius turns)
  (let* ((diameter (* radius 2))
         (circumference (* pi diameter)) )
    (* turns circumference) ) )

Contents    Page-10    Prev    Next    Page+10    Index