我尝试在sbcl 1.1.14中使用代码,但似乎类型检查忽略了vector元素的声明.
(defun test (vec)
(declare (type (vector integer) vec))
(format nil "~a~&" (elt vec 0)))
Run Code Online (Sandbox Code Playgroud)
任何提示?谢谢!
定义来自sbcl的src/code/array.lisp。看起来像是无限循环?我没有找到任何线索来获取它。有什么提示吗?谢谢你!
(defun row-major-aref (array index) |
#!+sb-doc |
"Return the element of array corressponding to the row-major index. This is |
SETF'able." |
(declare (optimize (safety 1))) |
(row-major-aref array index))
Run Code Online (Sandbox Code Playgroud)