GNU Common Lisp 的详细信息(类型)
如果在 REPL 中我输入:
(type-of (make-array 5))
然后我得到响应:
(SIMPLE-VECTOR 5)
足够公平。因此,如果在 REPL 中我输入:
(type-of (make-array (list 5 3 2)))
然后我得到响应:
(SIMPLE-ARRAY T (5 3 2))
我有两个问题。
T
在这里告诉我什么?如果它是NIL
,那会告诉我什么?- 我自己可以在哪里找到这个答案?我未能在(例如)Lisp HyperSpec 中找到答案。
If at the REPL I enter:
(type-of (make-array 5))
then I get the response:
(SIMPLE-VECTOR 5)
Fair enough. So if at the REPL I enter:
(type-of (make-array (list 5 3 2)))
then I get the response:
(SIMPLE-ARRAY T (5 3 2))
I have two questions.
- What is the
T
telling me here? If it had beenNIL
instead, what would that have told me? - Where could I have found this answer on my own? I failed to find the answer in (for example) the Lisp HyperSpec.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
(SIMPLE-ARRAY T (5 3 2))
是一个简单的三维数组。T
表示它是一个通用数组,可以包含任何元素类型。T
是最通用的类型。hyperspec 在此处记录了 SIMPLE-ARRAY 类型:
http://www.lispworks.com/documentation/HyperSpec/正文/t_smp_ar.htm
(SIMPLE-ARRAY T (5 3 2))
is a simple array of three dimensions.T
says that it is a general array which can contain any element type.T
is the most general type.The hyperspec documents the type SIMPLE-ARRAY here:
http://www.lispworks.com/documentation/HyperSpec/Body/t_smp_ar.htm
1)如果T是NIL,你将有一个三维数组,专门用于不存储数据(没有元素具有NIL类型;我相信所有类型都是NIL的超类型)。
1) If the T had been NIL, you would have a three-dimensional array, specialised in not storing data (no element has the type NIL; I believe all types are a super-type of NIL).