anchor.diff:           as r = (g* gf px base)
            finally (return r))))
   
  -
   (defmethod gdiv ((gf gf) dividend divisor)
     (let* ((numsym (1- (length divisor)))
  +         (numdat (length dividend))
            (dividend (rightp dividend (cdr divisor)))
            (divisor (rightp (cdr divisor) dividend)))
  -    (labels ((reduce-expr (e)
  +    (labels ((trim (l)
  +               (if (null l)
  +                   '()
  +                   (if (> (length l) numdat)
  +                       (subseq l 0 numdat)
  +                       l)))
  +             (reduce-expr (e)
                  (cond
                    ((not (consp e)) e)
                    ((equal 'times (cadr e))
  -                  (if (zerop (caddr e)) 0
  -                      (g* gf (car e) (reduce (lambda (x y) (g+ gf x y)) (loop for n in (cddr e) collect (reduce-expr n))))))
  +                  (g* gf (car e) (reduce (lambda (x y) (g+ gf x y)) (loop for n in (cddr e) collect (reduce-expr n)))))
                    ((consp (cadr e))
                     (reduce (lambda (x y) (g+ gf x y)) (loop for n in e collect (reduce-expr n))))
  -                 (t (g+ gf (car e) (reduce-expr (cadr e)))))))
  -      (let ((res (mapcar #'reduce-expr (polydiv dividend divisor))))
  +                 (t (g+ gf (car e) (reduce-expr (cadr e))))))
  +             (polydiv (dividend divisor)
  +               "build an expression tree representing the structure of two-polynomial division"
  +               (labels ((stp (coef xyz pn)
  +                          (let ((xyz (trim (reverse xyz))))
  +                            ;; (format t "~A~%" (cons coef (loop for p in pn
  +                            ;;                                for x in xyz
  +                            ;;                                collect (cons x (cons 'times p)))))
  +                            (cons coef
  +                                  (loop for p in pn
  +                                     for x in xyz
  +                                     collect (cons x (cons 'times p)))))))
  +                 (loop for a in dividend
  +                    for x in (cons nil divisor)
  +                    as px = nil then stps
  +                    collecting x into xyz
  +                    collecting (list (reduce-expr (stp a (cdr xyz) px))) into stps
  +                    finally (return stps)))))
  +      (let ((res (mapcar #'car (polydiv dividend divisor))))
           (values (subseq res 0 (- (length res) numsym))
                   (subseq res (- (length res) numsym)))))))
   
  
positive.code:     (loop for prodsum in (if (> (length p) (length q))
                               (polyprod p q)
                               (polyprod q p))
       collect (loop for x in prodsum
                  as pr = 0 then r
                  as r = (g+ gf pr (g* gf (car x) (cdr x)))
                  finally (return r))))
  
  (defmethod geval((gf gf) p x)
    (loop for z in (cdr p)
  
negative.code:                   for q1 in (reverse qq)
                    collect (cons q1 p0))))))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; CLOS definitions
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  