Subst
A single substitution into a tree
(Subst new old tree) is obtained by substituting new for
every occurrence of old in the given tree.
Equality to old is determined using the function eql. The
guard for (subst new old tree) requires (eqlablep old), which
ensures that the guard for eql will be met for each comparison
generated by subst.
Subst is defined in Common Lisp. See any Common Lisp documentation
for more information.
Function: subst
(defun subst (new old tree)
(declare (xargs :guard (eqlablep old)))
(cond ((eql old tree) new)
((atom tree) tree)
(t (cons (subst new old (car tree))
(subst new old (cdr tree))))))