【发布时间】:2021-08-10 03:04:52
【问题描述】:
我看不懂cs61A中的宏例子,谁能告诉我什么时候操作evals?
scm> (define (twice f) (begin f f))
twice
scm> (twice (print 'woof))
woof
我知道 (print 'woof) 第一个 eval 为 None 并绑定到 f,然后 return (begin None None) 为 None
但是
scm> (define (twice f) (begin f f))
twice
scm> (twice '(print 'woof))
(print (quote woof))
这让我很困惑......
'(print 'woof) 第一个 eval 为 (print 'woof) 并绑定到 f,然后 在两次函数中应该返回 (begin (print 'woof)(print 'woof)) 那么为什么不打印两次 woof 呢?
【问题讨论】: