while 的实现你没有写完,一次就停了:
(define (expand-predicate predicate i body)
(if (predicate i)
(cons 'begin body)))
(define (while->combination exp)
(expand-predicate
(while-predicate exp)
(while-variable exp)
(while-body exp)))
此外,for的实现我有疑问:
(define (expand-range start end proc)
(cond
((< start end)
(proc start)
(expand-range (+ start 1) end proc))))
在这里面 (proc start)的求值需要环境吧?
是否需要写成这样?
(define (expand-range start end proc env)
(cond
((< start end)
(eval (lambda () (proc start)) env)
(expand-range (+ start 1) end proc env)))
while 的实现你没有写完,一次就停了:
此外,for的实现我有疑问:
在这里面
(proc start)的求值需要环境吧?是否需要写成这样?