;; let*
(define (let*->nested-lets lexpr)
(match lexpr
- [`(let* (,first-binding ,rest-bindings ...) ,body)
- `(let (,first-binding) ,(let*->nested-lets `(let* ,rest-bindings ,body)))]
- [`(let* () ,body) body]))
+ [`(let* (,first-binding ,rest-bindings ...) ,body ..1)
+ `(let (,first-binding) ,(let*->nested-lets `(let* ,rest-bindings ,@body)))]
+ [`(let* () ,body ..1) `(let () ,@body)]))
;; internal definitions
(define (scan-out-definitions body)
;; eval
(define (eval exp env)
- ;; (display (format "~s~%" exp))
+ (display (format "~s~%" exp))
(match exp
[(? self-evaluating? exp) exp]
[(? variable? exp) (lookup-variable-value exp env)]
[`(begin ,exp ...) (eval-sequence exp env)]
[`(cond ,clauses ...) (eval (cond->if clauses) env)]
[`(let ,bindings ,body ..1) (eval (let->combination exp) env)]
- [`(let* ,bindings ,body) (eval (let*->nested-lets exp) env)]
+ [`(let* ,bindings ,body ..1) (eval (let*->nested-lets exp) env)]
[(list f x ...) (apply (eval f env) (list-of-values x env))]
[_ (error "unable to evaluate expression -- EVAL " exp)]))