Project:
 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 ``` ```; three list exercises (define (remove-nth n xs) (let loop ((i 1) (xs xs) (zs (list))) (cond ((null? xs) (reverse zs)) ((= i n) (loop 1 (cdr xs) zs)) (else (loop (+ i 1) (cdr xs) (cons (car xs) zs)))))) (display (remove-nth 4 '(1 2 3 4 5 6 7 8 9 10))) (newline) (define (remove-dups xs) (let loop ((xs xs) (zs (list))) (cond ((null? xs) (reverse zs)) ((member (car xs) zs) (loop (cdr xs) zs)) (else (loop (cdr xs) (cons (car xs) zs)))))) (display (remove-dups '(1 2 3 4 5))) (newline) (display (remove-dups '(1 1 2 3 4 5))) (newline) (display (remove-dups '(1 2 3 4 5 5))) (newline) (display (remove-dups '(1 2 1 3 1 4 1 5 1))) (newline) (display (remove-dups '(1 2 2 3 3 3 4 4 4 4 5 5 5 5 5))) (newline) (define (split xs) (let loop ((tortoise xs) (hare xs) (head (list))) (if (or (null? hare) (null? (cdr hare))) (values (reverse head) tortoise) (loop (cdr tortoise) (cddr hare) (cons (car tortoise) head))))) (call-with-values (lambda () (split '(1 2 3 4 5 6))) (lambda (head tail) (display head) (newline) (display tail) (newline))) (call-with-values (lambda () (split '(1 2 3 4 5 6 7))) (lambda (head tail) (display head) (newline) (display tail) (newline))) (define (range . args) (case (length args) ((1) (range 0 (car args) (if (negative? (car args)) -1 1))) ((2) (range (car args) (cadr args) (if (< (car args) (cadr args)) 1 -1))) ((3) (let ((le? (if (negative? (caddr args)) >= <=))) (let loop ((x(car args)) (xs '())) (if (le? (cadr args) x) (reverse xs) (loop (+ x (caddr args)) (cons x xs)))))) (else (error 'range "unrecognized arguments")))) (display (range 7)) (newline) (display (range 7 0)) (newline) (display (range -3)) (newline) (display (range 0 10 2)) (newline) (display (range 10 0 -2)) (newline) ```
 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ``` ```(1 2 3 5 6 7 9 10) (1 2 3 4 5) (1 2 3 4 5) (1 2 3 4 5) (1 2 3 4 5) (1 2 3 4 5) (1 2 3) (4 5 6) (1 2 3) (4 5 6 7) (0 1 2 3 4 5 6) (7 6 5 4 3 2 1) (0 -1 -2) (0 2 4 6 8) (10 8 6 4 2) ```