;This function returns #t iff ; mylist is a list of atoms, and ; none of the atoms are repeated. (define listOfUniqueAtoms? (lambda (mylist) (define sublist '()) (define firstMember '()) (cond ((null? mylist) #t) ((not (list? mylist)) #f) (else (begin (set! firstMember (car mylist)) (set! sublist (cdr mylist)) (cond ((not (atom? firstMember)) #f) ;memq: Buildin Scheme function: ; (memq 'a '(a b c)) ===>  (a b c) ; (memq 'b '(a b c)) ===>  (b c) ; (memq 'a '(b c d)) ===>  #f ((not (eq? (memq (car mylist) sublist) #f)) #f) (else (listOfUniqueAtoms? sublist)) ) ) ) ) ) ) ;============== Unit Tests ====================== (load "atom.scm") (load "test.scm") (define msg "listOfUniqueAtoms?") (test msg (listOfUniqueAtoms? '(a b c d)) #t) (test msg (listOfUniqueAtoms? '(a)) #t) (test msg (listOfUniqueAtoms? '()) #t) (test msg (listOfUniqueAtoms? '(a b c b)) #f) (test msg (listOfUniqueAtoms? '(a (b) c d)) #f)