lisp - 普通口齿不清 : Why not the array literal evaluate arguments?

标签 lisp common-lisp

为什么 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/

相关文章:

lisp - 方案: "expects 1 argument, given 4"奇怪的行为

recursion - 用尾递归解决 "n-rooks"

LISP 术语

types - Common Lisp 类型注释会导致不正常的行为吗?

lambda - 应该是lambda表达式-LISP

unit-testing - 为什么使用 Rackunit 进行的这个测试不起作用?

emacs - 当 'text-mode-hook 似乎不起作用时,我怎样才能让 emacs 显示行号?

vector - 根据键将向量拆分为向量的向量

macros - 带有 defclass 的 defmacro

lisp - 使用lisp添加两个列表