Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Last active December 20, 2016 07:11
Show Gist options
  • Save zhouqiang-cl/9679f813738a7a1fd308f2bdebc5f313 to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/9679f813738a7a1fd308f2bdebc5f313 to your computer and use it in GitHub Desktop.
common lisp 的 访问器 SYMBOL-PLIST
语法
symbol-plist symbol => plist
(setf (symbol-plist symbol) new-plist)
参数和值
symbol --- 一个 symbol
plist, new-plist --- 一个属性列表
描述
访问 symbol 的属性列表
代码
* (setq sym (gensym))
#:G605
* (symbol-plist sym)
NIL
* (setf (get sym 'prop1) 'val1)
VAL1
* (symbol-plist sym)
(PROP1 VAL1)
* (setf (get sym 'prop2) 'val2)
VAL2
* (symbol-plist sym)
(PROP2 VAL2 PROP1 VAL1)
* (setf (symbol-plist sym) (list 'prop3 'val3))
(PROP3 VAL3)
* (symbol-plist sym)
(PROP3 VAL3)
* (get sym 'PROP3)
VAL3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment