;;Chapter 3, Test 6, Page 43 (deftest test-sets () (check (member 2 (list 1 2 3)); is 2 part of (1 2 3) (not (member (list 2 3) (list (list 1 2) (list 2 3) (list 3 4)))) ; (2 3) is not part of the list b/c member defualts to equality via eql (member (list 2 3) (list (list 1 2) (list 2 3) (list 3 4)) :test #'equal); setting the test function to be equal. now it works. (member 3 (list (list 1 2) (list 2 3) (list 3 4)) :key #'car); using car for the lookup keys makes this work with associated lists (member-if #'zerop (list 1 2 3 0)) ;checks to make sure that zero is in the list >= 1 times. (equal (adjoin 1 (list 1 2 3)) (list 1 2 3)) ; makes sure that adjoin only adds to the list if it is not already in there. ;;These next two lines use set-difference with 2 lists containing the same ;;(if the test passes) values, this will return false. We cannot compare the ;;value of the output b/c the order of the output of union, intersection, ;;and set-difference is undefined. (not (set-difference (union (list 1 2 3) (list 2 3 4)) (list 1 2 3 4))) ;tests the usage of union. (not (set-difference (intersection (list 1 2 3) (list 2 3 4)) (list 2 3))))); tests the usage of intersection.