1.  
  2. ;;set0-helper : String relationp -> setp
  3. ;;returns a set of the elements in the relation related to the input String
  4.  
  5. (defun set0-helper (e r)
  6. (cond ((endp r) nil)
  7. ((set-memberp e (car r))
  8. (cons (car(car r)) (cons (cdr(car r)) (set0-helper e (cdr r)))))
  9. (t (set0-helper e (cdr r)))))
  10.  
  11. ;;set0 : relationp setp -> setp
  12. ;;returns a set of the elements related to the elements of the original set
  13.  
  14. (defun set0 (r s)
  15. (cond ((endp s) nil)
  16. (t (cons (set0-helper (car s) r) (set0 (cdr s) r)))))