为什么 Common Lisp 数组语法不计算它的参数:
(let ((a 1)) #2A((a 2) (3 4)))
=> #2A((A 2) (3 4))
我猜是 #2A((1 2) (3 4))
。这是因为 A
在读者时不可用吗?
最佳答案
简而言之,是的。
#2A((A 2) (3 4))
不是 (make-array '(2 2) :initial-contents (列表(列表 a 2)(列表 3 4)))
。如果有的话,它可以合理化为 (make-array '(2 2) :initial-contents (quote ((A 2) (3 4))))
,但这会有点误导因为数组构造已经在读取时发生。
关于lisp - 普通口齿不清 : Why not the array literal evaluate arguments?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3708793/