; test a, b and c for c = a∩b
; grab rref, minspan, rank from here.
; grab iden from here.
(define (testi a b c) (let ((ma (minspan a))(mb (minspan b))(mc (minspan c)))
(and (equal? c mc) (= (rank ma) (rank (append ma c))) (= (rank mb) (rank (append mb c)))
(equal? (minspan ma) (minspan (append ma c)))
(equal? (minspan mb) (minspan (append mb c)))
(= (+ (rank (append a b)) (rank c)) (+ (rank a)(rank b)))
)))
(define i (iden 10))
(define a (list (car i) (caddr (cddddr i)) (caddr i) (cadddr (cdddr (cdddr i)))
(caddr i) (cadr (cddddr i))))
(define b (list (cadddr i) (cadr i) (car (cddddr i)) (cadr i) (cadr (cddddr i))
(cadddr (cdddr (cdddr i))) (caddr i)))
(define c (inter a b))
(testi a b c)
; Include this code if your Scheme lacks a function called "random".
(define n 11)
(define (cmn k) (let v ((k k)) (if (= k 0) () (cons (let w ((j n))
(if (= j 0) () (cons (random 100) (w (- j 1))))) (v (- k 1))))))
(let* ((a (cmn 7))(b (cmn 8))(c (inter a b))) (write (list a b c)) (testi a b c))