let* vs. let


(let ((x 2) (y 3))
  (let ((x 7)
        (z (+ x y)))
    (* z x)))

= 35

The initial values in the inner let are evaluated ``simultaneously'' before the new variables are bound, so (+ x y) is evaluated with x = 2.


(let ((x 2) (y 3))
  (let* ((x 7)
         (z (+ x y)))
    (* z x)))

= 70

The initial values in the inner let* are evaluated sequentially, so (+ x y) is evaluated with x = 7.

Contents    Page-10    Prev    Next    Page+10    Index