We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Learn more about funding links in repositories.
Report abuse
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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)的求值需要环境吧? 是否需要写成这样?
(proc start)
(define (expand-range start end proc env) (cond ((< start end) (eval (lambda () (proc start)) env) (expand-range (+ start 1) end proc env)))
The text was updated successfully, but these errors were encountered:
看了下我的代码,这道题中的while与for实现方式确实都错了, 正确的方法应该是构造一个lambda,然后调用这个lambda来实现迭代。
while
for
lambda
其次,你提到的的(proc start)求值需要环境,我觉得是不需要的,因为proc与start在传递给expand-range的时候已经求好值了,这里直接用就好了。
proc
start
expand-range
等几天抽空,我把这个题重新做一遍,谢谢指出错误。
Sorry, something went wrong.
No branches or pull requests
while 的实现你没有写完,一次就停了:
此外,for的实现我有疑问:
在这里面
(proc start)
的求值需要环境吧?是否需要写成这样?
The text was updated successfully, but these errors were encountered: