Skip to content

Destructive operations

Macros that modify variables holding lists.

Macro: !cons (car cdr)

Destructive: Set cdr to the cons of car and cdr.

emacs-lisp
(let (l) (!cons 5 l) l)
    ⇒ (5)
emacs-lisp
(let ((l '(3))) (!cons 5 l) l)
    ⇒ (5 3)

Macro: !cdr (list)

Destructive: Set list to the cdr of list.

emacs-lisp
(let ((l '(3))) (!cdr l) l)
    ⇒ ()
emacs-lisp
(let ((l '(3 5))) (!cdr l) l)
    ⇒ (5)