Remove first occurrences, testing using eql
General Forms: (remove1 x lst) (remove1 x lst :test 'eql) ; same as above (eql as equality test) (remove1 x lst :test 'eq) ; same, but eq is equality test (remove1 x lst :test 'equal) ; same, but equal is equality test
Also see remove.
The guard for a call of
See equality-variants for a discussion of the relation between
(remove1-eq x lst) is equivalent to(remove1 x lst :test 'eq) ;
(remove1-equal x lst) is equivalent to(remove1 x lst :test 'equal) .
Function:
(defun remove1-equal (x l) (declare (xargs :guard (true-listp l))) (cond ((endp l) nil) ((equal x (car l)) (cdr l)) (t (cons-with-hint (car l) (remove1-equal x (cdr l)) l))))
In particular, reasoning about any of these primitives reduces to reasoning
about the function