The 'makunbound' function makes a symbol's value unbound. The 'symbol' must be a valid symbol, but it does not need to have a value. The 'makunbound' function returns the symbol as its result.
(defun makunbound (sym) (setf (symbol-value sym) '*unbound*) sym)
Note: The 'makunbound' function is intended to simplify porting code from Common Lisp to XLISP. This function is not included in the standard Nyquist distribution. If you want to use it, copy the code above to your 'init.lsp' file.
(setq myvar "hi") ; setup MYVAR "hi" myvar ; returns "hi" (makunbound 'myvar) ; returns MYVAR myvar ; error: unbound variable
Caution: With 'makunbound' you can also unbind internal XLISP
variables like *obarray* or
Note: 'makunbound' is not misspelled, there is no 'e' in it.
Note: The fmakunbound function works on functions [closures] in the same way that the 'makunbound' function works on variables. Be sure to use the correct one for what you are unbinding. These functions do not generate an error if you try to unbind the wrong type. This is because of the definition of these functions and the fact that the function and variable name spaces are separate. [You can have both a function called FOO and a variable called FOO.]
See also the XLISP Plus fmakunbound function.