;This function is taken form the textbook ; The Little Schemer page 41. ;It takes as arguments an atom myatom and a list mylist. ;It returns mylist without the first occurrence of myatom. (define rember (lambda (myatom mylist) (cond ((null? mylist) '()) ((not (atom? myatom) ) mylist) ((eq? (car mylist) myatom) (cdr mylist)) (else (cons (car mylist) (rember myatom (cdr mylist)) ) ) ) ) ) ;============== Unit Tests ====================== (load "atom.scm") (load "test.scm") (define msg "rember") (test msg (rember 'mint '(lamb chops and mint jelly)) '(lamb chops and jelly) ) (test msg (rember 'a '(x y z a a b)) '(x y z a b)) (test msg (rember 'a '(x y z)) '(x y z))