以下功能:
(defun check-for-arrow (x)
(format t "**~s**~s**~s**~s**"
(length (string x))
x
(eq x '->)
(and (eq (elt (string x) 0) #\-)
(eq (elt (string x) 1) #\>))) ; for debug
(eq x '->))
从 REPL 调用时,使用:
(check-for-arrow '->)
打印,带跟踪:
0> Calling (CHECK-FOR-ARROW ->)
**2**->**T**T**
<0 CHECK-FOR-ARROW returned T
相反,当在 Hunchentoot Web 应用程序中调用时,在表单中读取的数据上,当通过符号 '->' 调用时,会打印:
0> Calling (NORMALIZER::CHECK-FOR-ARROW ->)
**2**->**NIL**T**
<0 NORMALIZER::CHECK-FOR-ARROW returned NIL
Lisp 是 Clozure Common Lisp。
这是否取决于不同的符号实习方式?可以在符号上使用“eq”,或者我必须转换字符串中的箭头并检查字符串是否相等?
谢谢。