我遇到了以下代码片段:
(defstructure object
"An object is anything that occupies space. Some objects are 'alive'."
(name "?") ; Used to print the object on the map
(alive? nil) ; Is the object alive?
(loc (@ 1 1)) ; The square that the object is in
(bump nil) ; Has the object bumped into something?
(size 0.5) ; Size of object as proportion of loc
(color 'black) ; Some objects have a color
(shape 'rectangle) ; Some objects have a shape
(sound nil) ; Some objects create a sound
(contents '()) ; Some objects contain others
(max-contents 0.4) ; How much (total size) can fit inside?
(container nil) ; Some objects are contained by another
(heading (@ 1 0)) ; Direction object is facing as unit vector
)
Run Code Online (Sandbox Code Playgroud)
我不确定这里的@是什么意思.我已经搜索了其余的代码,看看它是否被定义为一个函数,但却找不到任何东西.我的问题,是"@"常用lisp的一些常用实现的一部分,还是这个代码具体?谢谢.
链接到文件:https: //github.com/aimacode/aima-lisp/blob/master/agents/environments/grid-env.lisp
该功能定义utilities/utilities.lisp
如下:
(defun @ (x y) "Create a 2-D point" (make-xy :x x :y y))
Run Code Online (Sandbox Code Playgroud)
它创建一个点(或矢量).
为了找到定义,我不得不克隆存储库,因为GitHub搜索在搜索代码时几乎没用:
find -name "*.lisp" -exec grep -H @ {} \;
...
./utilities/utilities.lisp:(defun @ (x y) "Create a 2-D point" (make-xy :x x :y y))
...
Run Code Online (Sandbox Code Playgroud)
我没有搜索,defun
因为它也可能是一个宏.