#| Problem: 5.1 Authors: Hannibal F. and Cannibal G. Date: January 20, 2000 A list of indices is either * empty * (cons i loi) where i is an index and loi is a list of indices. [self-reference: from loi to list of indices] An index is an integer between 0 and 9. |# ;; remove : index list-of-indices -> list-of-indices ;; Examples: ;; (remove 0 (list 0 1 2 0 3)) = (list 1 2 3) (define (remove an-i a-loi) (cond [(empty? a-loi) empty] [else (cond [(eq? (first a-loi) an-i) (remove an-i (rest a-loi))] [else (cons (first a-loi) (remove an-i (rest a-loi)))])])) #| Tests: the simplest tests to check return #t: (equal? (remove 0 (list 0 1 2 0 3)) (list 1 2 3)) (equal? (remove 2 (list 0 1 2 0 3)) (list 0 1 0 3)) |#