;; gather-green-eyed: person -> list-of-string ;; returns a list of the names of all people in the person's tree who have ;; green eyes (define (gather-green-eyed adt) (cond [(symbol=? (person-eye adt) 'green) (cons (person-name adt) (gather-green-eyed-list (person-children adt)))] [else (gather-green-eyed-list (person-children adt))])) ;; gather-green-eyed-list: list-of-person -> list-of-string ;; consumes a list of person and produces a list of names of all ;; those people in the list (and their descendants) who have green eyes (define (gather-green-eyed-list alop) (cond [(empty? alop) empty] [(cons? alop) (append (gather-green-eyed (first alop)) (gather-green-eyed-list (rest alop)))]))