*18.8.2-4
久しぶりになってしまいました。
p250くらいまでやっとこさ辿りつきました。
あー、滅茶苦茶楽しくなってきました(理解度とは比例せず)。。
(define (list=? a-list another-list) ;;17.8.2 (cond ((and (cons? a-list) (empty? another-list)) false) ((and (empty? a-list) (cons? another-list)) false) (else (or (and (empty? a-list) (empty? another-list)) (or (= (first a-list) (first another-list)) (list=? (rest a-list) (rest another-list))))))) (define sym-list=? ;;17.1.3 (lambda (a-list another-list) (cond ((empty? a-list) (empty? another-list)) ((cons? a-list) (and (cons? another-list) (and (symbol=? (first a-list) (first another-list)) (sym-list=? (rest a-list) (rest another-list)))))))) (define contains-same-numbers ;;17.8.4 (lambda (a-lon another-lon) (cond ((empty? a-lon) true) ((and (empty? a-lon) (cons? another-lon)) false) ((and (cons? a-lon) (empty? another-lon)) false) ((find-n (first a-lon) another-lon) (contains-same-numbers (rest a-lon) another-lon))))) (define find-n (lambda (n lon) (cond ((empty? lon) false) ((= n (first lon)) true) (else (find-n n (rest lon))))))