Example:
(MEMBER 'hello '(a b c d) ) = Nil (MEMBER 'b '(a b c d) ) = (b c d) (MEMBER 'b '() ) = Nil
TRY:
Exercise:Also, you can write your own recursive function to test if an item is member of a set. Try to do it.
Example:
(ADJOIN 'a '(a b c d) ) = (a b c d) (ADJOIN 'e '(a b c d) ) = (a b c d e)
TRY:
Example:
(UNION '(e f g h) '(a b c d) ) = (e f g h a b c d) (UNION '(a b c) '(d b e) ) = (a b c d e)
TRY:
Exercise:
Now, using the definition and your knowledge about
recursive functions, to write your own UNIONSET function.
Example:
(INTERSECTION '(e f g h) '(a b f d) ) = (f) (INTERSECTION '(a b c) '(d b e) ) = (b) (INTERSECTION '(a b c) '(d e f) ) = ()
TRY:
Exercise:
Now, using the definition and your knowledge about
recursive functions, to write your own INTERSET function.