似乎做了intern
所做的事情。也许是(intern (read sym))
。但这是为了什么?我看到它被用作:
(if (keywordp x)
(alexandria:ensure-symbol x)
x)
在什么情况下可能是某个关键字但不是符号?
答案 0 :(得分:2)
有问题的函数是defined
(declaim (inline ensure-symbol))
(defun ensure-symbol (name &optional (package *package*))
"Returns a symbol with name designated by NAME, accessible in package
designated by PACKAGE. If symbol is not already accessible in PACKAGE, it is
interned there. Returns a secondary value reflecting the status of the symbol
in the package, which matches the secondary return value of INTERN.
Example:
(ensure-symbol :cons :cl) => cl:cons, :external
"
(intern (string name) package))
即,您的代码段执行此操作:如果x
是keyword(在symbol包中实习KEYWORD
),则会返回"普通& #34;当前包*package*
中具有相同名称的符号(否则返回x
)。