#+#是什么.刻薄的意思? [英] What does #+#. mean in lisp?
问题描述
用google几乎是不可能的,因此我的理解仅限于通过阅读史莱姆源代码获得的上下文线索:也许它是通用Lisp中对象系统的一部分?像自我"一样?
It is almost impossible to google, hence my understanding is limited to contextual clues from reading through the slime source code: perhaps it is part of the object system in common lisp? Something like 'self'?
摘要:
(cond #+#.(swank-backend::sbcl-with-new-stepper-p)
也许这将使其更易于搜索:磅加磅//哈希加哈希符号//octothorp加上octothorp
Perhaps this will make it more googleable : pound plus pound // hash plus hash symbol // octothorp plus octothorp
推荐答案
这种情况很少见.
#+clim clim:+red+ #-clim mygraphics:+red+
上面的
表示阅读器返回两个红色符号,这取决于功能列表*features*
中是否存在名称为CLIM的符号.这是Common Lisp中的内置机制.
above means that the reader returns either red symbol and it depends whether there is a symbol with the name CLIM is on the list of features *features*
. That's a built-in mechanism in Common Lisp.
#.(cl:if (cl:zerop (cl:random 2)) :high :low)
以上也是读者的一种机制.它允许在读取时进行计算.顺便说一句.这是一个安全问题,在Lisp应用程序中应将其禁用-请参见变量*read-eval*
进行控制.在阅读时,使用READ的阅读器将随机返回:HIGH或:LOW.
Above also is a mechanism of the reader. It allows to do computations at read time. Which btw. is a security problem and in Lisp applications it should be disabled - see the variable *read-eval*
for controlling this. At read time the reader using READ will return either :HIGH or :LOW, randomly.
组合#+#.(FOO) BAR
表示函数foo在读取时返回一个符号,然后读者会检查该符号,如果功能列表*features*
中是否存在具有该名称的符号,并且是这种情况,然后读取输入中的下一项,否则跳过下一项.
The combination #+#.(FOO) BAR
means that the function foo returns a symbol at read time and this symbol then is checked by the reader if there is a symbol with this name on the feature list *features*
and if that is the case, then the next item in input is read, otherwise the next item is skipped over.
相对的示例,在此示例中,IF始终返回:CAPI:
Trivial example, IF always returns :CAPI in this example:
在LispWorks(功能列表中的CAPI)中:
In LispWorks (where CAPI is on the features list):
CL-USER 41 > (read-from-string "#+#.(cl:if cl:t :capi :clim) a b")
A
31
在SBCL中
* (read-from-string "#+#.(cl:if cl:t :capi :clim) a b")
B
32
这篇关于#+#是什么.刻薄的意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!