Lab 1: Problems about Sets

  1. Define UNION. The union of two sets is a set containing all the elements that are in either of the two sets.

  2. Define INTERSECTION. The intersection of two sets is a set containing only the elements that are in both of the sets.

  3. Define LDIFFERENCE. The difference of two sets, the IN set and the OUT set, is what remains of the set IN after all the elements that are also elements of the set OUT are removed.

  4. Define INTERSECTP, a predicate which tests whether two sets have any elements in common. It is to return NIL if the two sets are disjoint.

  5. Define SAMESETP, a predicate which tests whether two sets contain the same elements. Note that the two lists representing the sets may be arranged in different orders.

If the LISP version you are using already has such a function defined, then name your function something different. For example,
MYUNION

HINT: I did all of these functions (except SAMESETP) using recursion... and the only functions I used were the above functions themselves and

Quite often in lisps, file names are case-sensitive. More specifically, file names are case-sensitive on xlisp on the 850. When you load your file, it must be in capitals.

This is a general type of mistake people make in lisp, i.e., when all looks good and will not work...try caps

If you get an error message
STACK OVERFLOW
this is probably because your recursive routine is incorrect
(no stopping condition).