【发布时间】:2020-07-05 21:11:17
【问题描述】:
在《计算机程序的结构和解释》一书中,Section 2.4.3,它说:
(get <op> <type>)在表中查找, 条目并返回在那里找到的项目。
而apply-generic 被定义为
(define (apply-generic op . args)
(let ((type-tags (map type-tag args)))
(let ((proc (get op type-tags)))
(if proc
(apply proc (map contents args))
(error "No method for these types: APPLY-GENERIC"
(list op type-tags))))))
(map type-tag args) 返回一个列表,但 get 不应该期望在 (get op type-tags) 中将单个符号作为其第二个参数?
【问题讨论】: