Practice 4.9
语法形式
(for init-seq critical after-loop body)
调用示例
(for ((define i 0) (define j 0))
(< i 10)
((set! i (+ i 1)) (set! j (+ j 2)))
(display i))
(define (for? exp)
(tagged-list? exp 'for))
(define (for-init-seq exp)
(cadr exp))
(define (for-critical exp)
(caddr exp))
(define (for-after-loop exp)
(cadddr exp))
(define (for-body exp)
(caddddr exp))
(define (for->seq exp)
(let ((init-seq (for-init-seq exp))
(critical (for-critical exp))
(after-loop (for-after-loop exp))
(body (for-body exp)))
(seq->exp
(list
(seq->exp init-seq)
(list 'define rec (make-lambda critical
(make-if critical
(seq->exp (list
body
(seq-exp after-loop)
(list rec critical))))))
(list rec critical)))))