Function 我可以在Common Lisp中取消调用函数吗

Function 我可以在Common Lisp中取消调用函数吗,function,emacs,common-lisp,Function,Emacs,Common Lisp,我正在学习defclass和defmethod和defgeneric,所以我制作了一个名为defclass的defclass会员账户余额 我创建了一个defun(如下所示)来开始改变余额的值,但它还没有完成 (defun balance (account) (slot-value account 'balance)) 然后我决定改为使用defgeneric(如下) 但是当我运行defgeneric时,我得到了以下错误: BALANCE已经命名了一个普通函数或宏 有没有一种方法可以轻松取消调

我正在学习
defclass
defmethod
defgeneric
,所以我制作了一个名为
defclass
defclass
会员账户
余额

我创建了一个
defun
(如下所示)来开始改变余额的值,但它还没有完成

(defun balance (account)
  (slot-value account 'balance))
然后我决定改为使用
defgeneric
(如下)

但是当我运行
defgeneric
时,我得到了以下错误:

BALANCE已经命名了一个普通函数或宏


有没有一种方法可以轻松取消调用或取消声明平衡,这样我就不必重新启动Emacs会话?

您可以使用删除函数定义(使用defun或defgeneric创建)。

任何自尊心强的Lisp都会为您提供错误重启来更改定义

这里是SLIME和Clozure CL:

The function BALANCE is defined as something other than a generic function.
   [Condition of type CCL::SIMPLE-PROGRAM-ERROR]

Restarts:
 0: [CONTINUE] Try to remove any global non-generic function or macro definition.
 1: [RETRY] Retry SLIME REPL evaluation request.
 2: [*ABORT] Return to SLIME's top level.
 3: [ABORT-BREAK] Reset this thread
 4: [ABORT] Kill this thread
只需在该缓冲区中键入0或选择相应的行并按return键,即可选择继续重新启动


除Xach的回答外,使用SLIME您只需将文本光标移动到函数名上,然后键入c-c c-u,这将调用
SLIME-UNDEFINE-function

两个代码段都使用
defun
,不是
defgeneric
@Chris….对不起,=)我做了适当的编辑..关于这个问题有什么建议吗,我的好朋友?顺便说一句,你通常不会做
(defun balance(account)(slot value account'balance)
;你只需要定义一个
balance
方法作为一个读卡器(或访问器):
(defclass account。。。(balance…:reader balance…)
@非常感谢您,先生,我选择您的答案是因为这是最快的完成方式……对您来说是非常美好的一天=)。
The function BALANCE is defined as something other than a generic function.
   [Condition of type CCL::SIMPLE-PROGRAM-ERROR]

Restarts:
 0: [CONTINUE] Try to remove any global non-generic function or macro definition.
 1: [RETRY] Retry SLIME REPL evaluation request.
 2: [*ABORT] Return to SLIME's top level.
 3: [ABORT-BREAK] Reset this thread
 4: [ABORT] Kill this thread