我在Scheme中准备了几行,我是Scheme的新手。请在下面发表您对我的代码的评论:
(define new3
(lambda(y)
(define points 444)
(define add3 (lambda (x)(+ x 3)))
(display "--")
(display points)
(if (and (= 1 1)(= 2 2))(add3 points))
(display "--")
(display points)
(list points points)
))
(new3 7)
输出
--444--444(444 444)
我想知道为什么“if”之后的“分数”不等于“447”?
谢谢。
答案 0 :(得分:1)
那是因为你没有就地更新points
。您使用477
计算了(add3 points)
,但没有将结果存储在任何位置。