Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Last active December 19, 2016 07:52
Show Gist options
  • Save zhouqiang-cl/bdc597e02b0b19c8390d6f5c1170fc92 to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/bdc597e02b0b19c8390d6f5c1170fc92 to your computer and use it in GitHub Desktop.
common lisp 的函数 ARRAY-IN-BOUNDS-P
语法
array-in-bounds-p array &rest subscripts => generalized-boolean
参数和值
array --- 一个 array
subscripts --- 一个 整数列表, 这个列表的长度和array 的rank 一样
generalized-boolean --- 一个 generalized-boolean
描述
如果 subscripts 在 array 的范围内, 返回 true, 否则返回 false
代码
* (setq a (make-array '(7 11) :element-type 'string-char))
#2A((0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0)
(0 0 0 0 0 0 0 0 0 0 0))
* (array-in-bounds-p a 0 0)
T
* (array-in-bounds-p a 6 10)
T
* (array-in-bounds-p a 7 0)
NIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment