(lambda (zer zer? + - * num? one) (let ( (ad (lambda (a b) (let ad ((a a)(b b)) (if (null? a) b (if (null? b) a (let ( (c (+ (car a)(car b))) (d (ad (cdr a)(cdr b)))) (if (null? d) (if (zer? c) '() (list c)) (cons c d)))))))) (neg (lambda (a) (let n ((a a)) (if (null? a) '() (cons (- zer (car a)) (n (cdr a))))))) ; (sm (lambda (s a) (if (zer? s) '() (let m ((a a)) ; (if (null? a) '() (cons (* s (car a)) (m (cdr a)))))))) (sm (lambda (s a) (if (zer? s) '() (let m ((a a)) (if (null? a) a (let ((H (* s (car a))) (T (m (cdr a)))) (if (and (null? H) (null? T)) H (cons H T)))))))) ) (list ad (lambda (a b) (ad a (neg b))) (lambda (a b) (let M ((a a)) (if (null? a) '() (ad (sm (car a) b) (let ((t (M (cdr a)))) (if (null? t) '() (cons zer t))))))) sm (lambda (p) (let t ((p p)(w one)) (or (and (null? p) (not (zer? w))) (and (pair? p) (num? (car p)) (t (cdr p) (car p))))))))) ;tests (define t ((fileVal "Poly/poly") 0 zero? + - * number? 1)) (define ad (car t)) (define sub (cadr t)) (define mul (caddr t)) (define sm (cadddr t)) (define pt (car (cddddr t))) (mul '(1 1) '(1 1)) ; => (1 2 1) (sm 3 '(2 3 4)) ; => (6 9 12) (ad '(2 3 4) '(2 3 -4)) ; => (4 6) (map pt '((3 1) () (4 2 0) (0) (2))) ; => (#t #t #f #f #t) (define u ((fileVal "Poly/poly") '() null? ad sub mul pt '(1))) ((caddr u) '( () (5)) '( () (4))) ; => (() () (20))