I need a procedure which takes a list and checks if an element is part of that list even when the list contains lists. So far, I\'ve written this:
(define (elem
You just need another clause to check if the car is a list. Add this to your cond (after the eq? clause):
car
cond
eq?
((list? (car set)) (or (element-of-set? element (car set)) (element-of-set? element (cdr set))))
This recurses on any sublists.