Problem 6: Let *! (100 pts)

Note: You are supposed to finish this problem after Wednesday's lecture about Macros.

Let's meet a new special form let*, which has a form similar to let:

(let*
  ((name1 expr1)
   (name2 expr2)
   ...
   (nameN exprN))
  expr)

What let* does is similar to let, and the only difference is that the bindings are performed sequentially (one by one), i.e., expr1 is evaluated first and name1 is immediately bound to it, then expr2 and name2, and so on. In contrast, with let, expr1 through exprN are firstly evaluated without binding name1, ..., nameN to them; after that, the names are bound to the corresponding values.

Note:

  1. expr stands for a single expression. Expressions like (let* ((x 1) (y (+ x 1))) (print x) y) is outside the scope of this problem, you don't need to care about it.
  2. expr should always be evaled in the local frame.

Hint1: Use recursion, it is available in macro.

Hint2: You can use let to implement let*.

(define-macro (let* bindings expr)
  ''YOUR-CODE-HERE
)

;;; Tests
; scm> (define y 0)
; y
; scm> (let* ((x 1) (y (+ x 1))) y)
; 2
; scm> y
; 0