The routines below build polynomial arithmetic from simpler arithmetic. The routine polpak takes a suite of primitives and returns a like suite of primitives dealing in polynomials in the former. The yield of polpak is the same form as its input and thus applying it twice gives bivariate polynomials, etc.

See the algebra for the Lagrange points for the only application of this so far.

```(define (ga add zer?) (lambda (a b) (let pls ((a a)(b b))
(if (null? a) b (if (null? b) a
(let ((s (add (car a) (car b))) (t (pls (cdr a) (cdr b))))
(if (and (zer? s) (null? t)) '() (cons s t))))))))

(define (gn neg) (lambda (a) (let ng ((a a))
(if (null? a) '() (cons (neg (car a)) (ng (cdr a)))))))

(define (gsm mul) (lambda (s p) (let m ((p p))
(if (null? p) '() (cons (mul s (car p)) (m (cdr p)))))))

(define (gm mul sm na) (lambda (a b)
(if (null? b) '() (let ml ((a a))
(if (null? a) '() (let ((q (sm (car a) b)))
(cons (car q) (na (ml (cdr a))(cdr q)))))))))

(define (polpak add mul neg zer?) (let* ((na (ga add zer?))
(nn (gn neg))(nsm (gsm mul))(nm (gm mul nsm na)))
(list na nm nn (lambda (p) (let t ((p p))
(or (null? p) (and (zer? (car p)) (t (cdr p)))))))))

(define (html v sp) (lambda (p) (let ((lp "(")(rp ")"))
(string-append lp (let pe ((p p)(xpn 1))
(if (null? p) "0" (if (null? (cdr p)) (sp (car p)) (string-append
(pe (cdr p) (+ 1 xpn)) v (if (> xpn 1) (string-append
"<sup>" (number->string xpn) "</sup>") "")
" + " (sp (car p)))))) rp))))
```
; And some too trivial tests:
```((html "r" number->string) '(2 3 4)) ; => (4r2 + 3r + 2)
((html "r" (html "m" number->string)) '((2 3 4 5) (3 2 1) (3 7) (9)))
; => ((9)r3 + (7m + 3)r2 + (1m2 + 2m + 3)r + (5m3 + 4m2 + 3m + 2))
(define ol (polpak + * - zero?))
(define o2 (apply polpak ol))
(define a2 (car o2))
(define m2 (cadr o2))
(define n2 (caddr o2))
(define z2? (cadddr o2))
(a2 '((3 4) (4 5 6) (11)) '((3))) ; => ((6 4) (4 5 6) (11))
(let ((z '((3 4) (4 5 6) (11)))) (m2 z z))
; => ((9 24 16) (24 62 76 48) (82 128 73 60 36) (88 110 132) (121))
```
Perhaps this is a better version.