Is it possible in Lisp to undefine Macros and Functions?
common-lisp, lisp, macros
Solution
Yes, you can use `fmakunbound` for this.
It works for both functions and macros. Here's an example REPL session:
CL-USER> (defun add (n m) (+ n m))
ADD
CL-USER> (add 1 2)
3
CL-USER> (fmakunbound 'add)
ADD
CL-USER> (add 1 2)
; [snip]
; Evaluation aborted on #<UNDEFINED-FUNCTION ADD {C3305F1}>.
Note that it really is fmak rather than fmake. That still trips me up from time to time.
Problem
While using the REPL it would be helpful to undefine defined functions and macros, exspecially if you tried to make a macro for something, and then simulate it as function, and the macro is called everytime. Is it possible in Common Lisp to undefine?