Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Created December 19, 2016 08:33
Show Gist options
  • Save zhouqiang-cl/c317bfafc782f918a4e080631c7e4782 to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/c317bfafc782f918a4e080631c7e4782 to your computer and use it in GitHub Desktop.
common lisp 的访问器 FILL-POINTER
语法
fill-pointer vector => fill-pointer
(setf (fill-pointer vector) new-fill-pointer)
参数和值
vector --- 一个 vector
fill-pointer, new-fill-pointer --- 一个有效的 fill pointer
描述
访问 vector 的 fill pointer
代码
* (setq a (make-array 8 :fill-pointer 4))
#(0 0 0 0)
* (fill-pointer a)
4
* (dotimes (i (length a)) (setf (aref a i) (* i i)))
NIL
* a
#(0 1 4 9)
* (setf (fill-pointer a) 3)
3
* (fill-pointer a)
3
* a
#(0 1 4)
* (setf (fill-pointer a) 8)
8
* a
#(0 1 4 9 0 0 0 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment