Lisp强制和设置函数说明

Lisp强制和设置函数说明,lisp,set,quote,coerce,Lisp,Set,Quote,Coerce,我试着直接解释: (setf example (coerce "blablabla" 'list)) 而且效果很好。事实上(汽车示例)返回#\b 但如果我尝试这样做: (defun myfun (string) ( (setf example (coerce string 'list)))) (myfun "blablabla") 我不一样 如何修复?删除defun中setf周围的额外括号: (defun myfun (string) (setf example (coerce st

我试着直接解释:

(setf example (coerce "blablabla" 'list))
而且效果很好。事实上
(汽车示例)
返回#\b

但如果我尝试这样做:

(defun myfun (string) ( (setf example (coerce string 'list))))

(myfun "blablabla") 
我不一样


如何修复?

删除
defun
setf
周围的额外括号:

(defun myfun (string)
  (setf example (coerce string 'list)))

现在你会得到同样的结果。请注意,外括号具有含义。在Lisp中,它要么被引用,要么必须是函数调用。如果第一个元素(如本例所示)是一个列表,则它不能是一个要调用的函数,因此会出现错误。

oh!美好的多么愚蠢的错误。。。这让我发疯!!!谢谢你的耐心!