blob: 9892a4a21b2bac1d49d15b631acf0c9cb547d1f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
* forget
Forget things about symbols. Handy during interactive development.
The ~forget~ function will forget function bindings, symbol bindings,
and class bindings. It will also unintern a symbol from its home package.
The ~forget~ function can forget packages too, but you must pass
~:package? t~ as an argument.
Any of the default options can be turned off by passing ~nil~ to the
appropriate option. E.g. if you wanted to forget everything but not
unintern the symbol, you'd pass ~:intern? nil~.
Example:
#+begin_src lisp
CL-USER> (defvar unremarkable "hey")
UNREMARKABLE
CL-USER> (defun unremarkable () "hey")
UNREMARKABLE
CL-USER> (defclass unremarkable () ())
#<STANDARD-CLASS COMMON-LISP-USER::UNREMARKABLE>
CL-USER> (setf (get 'unremarkable :hey) "you")
"you"
CL-USER> (defpackage :unremarkable (:use #:cl))
#<PACKAGE "UNREMARKABLE">
CL-USER> (forget:forget 'unremarkable)
WARNING: Unbinding function UNREMARKABLE
WARNING: Unbinding value UNREMARKABLE
WARNING: Unbinding class UNREMARKABLE
WARNING: Dropping symbol-plist on UNREMARKABLE
WARNING: Uninterning UNREMARKABLE from "COMMON-LISP-USER"
NIL
CL-USER> (forget:forget 'unremarkable :package? t)
WARNING: Uninterning UNREMARKABLE from "COMMON-LISP-USER"
WARNING: Deleting package "UNREMARKABLE"
T
CL-USER>
#+end_src
|