;; rember and multirember ;; rember removes the first occurrence of an atom from a list ;; multirember removes all occurrences (defun rember (a mylist) (if (null mylist) () (if (eq a (car mylist)) (cdr mylist) (cons (car mylist) (rember a (cdr mylist))) ) ) ) (defun multirember (a mylist) (if (null mylist) () (if (eq a (car mylist)) (multirember a (cdr mylist) ) (cons (car mylist) (multirember a (cdr mylist))) ) ) ) ;; firsts and seconds ;; take the list of first elements (or second elements) ;; from a list of pairs (defun firsts (mylist) (if (null mylist) () (cons (car (car mylist)) (firsts (cdr mylist))) ) ) (defun seconds (mylist) (if (null mylist) () (cons (cadr (car mylist)) (seconds (cdr mylist))) ) )