All notes
Lisp

Language Reference

Variables

makunbound

This function empties out the value cell of symbol, making the variable void. It returns symbol.


(setq x 1)               ; Put a value in the global binding.
; 1

(let ((x 2))             ; Locally bind it.
  (makunbound 'x)        ; Void the local binding.
  x)
; error: Symbol's value as variable is void: x
x                        ; The global binding is unchanged.
; 1

(let ((x 2))             ; Locally bind it.
  (let ((x 3))           ; And again.
    (makunbound 'x)      ; Void the innermost-local binding.
    x))                  ; And refer: it’s void.
; error: Symbol's value as variable is void: x

(let ((x 2))
  (let ((x 3))
    (makunbound 'x))     ; Void inner binding, then remove it.
  x)                     ; Now outer let binding is visible.
; 2

boundp

This function returns t if variable (a symbol) is not void, and nil if it is void.


(boundp 'abracadabra)          ; Starts out void.
; nil

(let ((abracadabra 5))         ; Locally bind it.
  (boundp 'abracadabra))
; t
(boundp 'abracadabra)          ; Still globally void.
; nil

(setq abracadabra 5)           ; Make it globally nonvoid.
; 5
(boundp 'abracadabra)
; t