From: Frederick C. Gibson, Architect
Subject: Deleting a function
Date: 
Message-ID: <398e1f70.46415622@news.pacbell.net>
I want to create a method to replace a function of the same name, but
Lisp will not let me do it while the function still exists.  Is there
a way to delete the function from the lisp environment?

Thanks!


Fred Gibson, Architect

·········@gibson-design.com     Architecture Designed Objectively
==================================-----------||||||||||||||||||||||
Frederick Clifford Gibson Architect & Associates

     1220 14th Avenue Suite 106
     San Francisco, CA  94122
     415.753.3797 |tel|  415.759.8848 |fax|

     (c)1999 http://www.gibson-design.com

     ART:  Temple of Triumph *Building* Project
           http://www.art-21.org/Temple
     EASG: Epistemology-Aesthetics Study Group
           http://www.gibson-design.com/philosophy
     

From: Coby Beck
Subject: Re: Deleting a function
Date: 
Message-ID: <RMqj5.20892$47.329274@news.bc.tac.net>
"Frederick C. Gibson, Architect" <·········@gibson-design.com> wrote in
message ······················@news.pacbell.net...
> I want to create a method to replace a function of the same name, but
> Lisp will not let me do it while the function still exists.  Is there
> a way to delete the function from the lisp environment?
>

Try fmakunbound:

-> (defun foo()
  t)
FOO
-> (defmethod foo()
  nil)
Error: Non-generic function already exists with name FOO
[condition type: PROGRAM-ERROR]
-> (fmakunbound 'foo)
FOO
-> (defmethod foo()
  nil)
#<STANDARD-METHOD FOO NIL>
->

Coby
From: Christopher C Stacy
Subject: Re: Deleting a function
Date: 
Message-ID: <x8l3dkhyat7.fsf@world.std.com>
>>>>> On Mon, 07 Aug 2000 02:35:12 GMT, Frederick C Gibson, Architect ("Frederick") writes:
 Frederick> I want to create a method to replace a function of the same name, but
 Frederick> Lisp will not let me do it while the function still exists.  Is there
 Frederick> a way to delete the function from the lisp environment?

(FMAKUNBOUND 'FOO)

In Lispworks, there is a proceed option to the error that will call it for you.
From: Dave Seaman
Subject: Re: Deleting a function
Date: 
Message-ID: <8mmgjc$imd@seaman.cc.purdue.edu>
In article <·················@news.pacbell.net>,
Frederick C. Gibson, Architect <·········@gibson-design.com> wrote:
>I want to create a method to replace a function of the same name, but
>Lisp will not let me do it while the function still exists.  Is there
>a way to delete the function from the lisp environment?

It's not necessary to delete the function, and probably not a good idea
if the function is in the COMMON-LISP package.  What you should do
instead is create a new package for your own code and shadow the function
that you want to redefine.

	(defpackage :my-package
	  (:use :cl)
	  (:shadow get))

	(in-package :my-package)

	;;; ...

	(defmethod get ((self my-class) attribute)
	  "My version of get"
	  ;; ...

You can still use the standard get in your package if you need to, by
spelling it cl:get.

-- 
Dave Seaman			·······@purdue.edu
Amnesty International calls for new trial for Mumia Abu-Jamal
<http://www.refuseandresist.org/mumia/021700amnesty.html>