Created
December 19, 2016 08:33
-
-
Save zhouqiang-cl/c317bfafc782f918a4e080631c7e4782 to your computer and use it in GitHub Desktop.
common lisp 的访问器 FILL-POINTER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
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