Code Review

Compare your solutions

    #| BEGIN (Write your solution here) |#
(define (let*->nested-lets exp)
  (define (loop bindings body)
    (if (null? bindings)
        (if (last-exp? body)
            (car body)
            (cons 'begin body))
        (list 'let
              (list (car bindings))
              (loop (cdr bindings) body))))
  (loop (let-bindings exp) (let-body exp)))

(define (let-bindings exp)
  (cadr exp))

(define (let-body exp)
  (cddr exp))
#| END |#