;;set0-helper : String relationp -> setp ;;returns a set of the elements in the relation related to the input String (defun set0-helper (e r) (cond ((endp r) nil) ((set-memberp e (car r)) (cons (car(car r)) (cons (cdr(car r)) (set0-helper e (cdr r))))) (t (set0-helper e (cdr r))))) ;;set0 : relationp setp -> setp ;;returns a set of the elements related to the elements of the original set (defun set0 (r s) (cond ((endp s) nil) (t (cons (set0-helper (car s) r) (set0 (cdr s) r)))))