Changeset 935 for branches/f4grobner
- Timestamp:
- 2015-06-09T19:12:13-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/termlist.lisp
r894 r935 132 132 f)) 133 133 134 (defun termlist-add (ring p q) 134 (defun termlist-add (ring-and-order p q 135 &aux 136 (ring (ro-ring ring-and-order)) 137 (order (ro-order ring-and-order))) 138 (declare (type list p q) (ring-and-order ring-and-order)) 139 (do (r) 140 ((cond 141 ((endp p) 142 (setf r (revappend r q)) t) 143 ((endp q) 144 (setf r (revappend r p)) t) 145 (t 146 (multiple-value-bind 147 (lm-greater lm-equal) 148 (funcall order (termlist-lm p) (termlist-lm q)) 149 (cond 150 (lm-equal 151 (let ((s (funcall (ring-add ring) (termlist-lc p) (termlist-lc q)))) 152 (unless (funcall (ring-zerop ring) s) ;check for cancellation 153 (setf r (cons (make-term (termlist-lm p) s) r))) 154 (setf p (cdr p) q (cdr q)))) 155 (lm-greater 156 (setf r (cons (car p) r) 157 p (cdr p))) 158 (t (setf r (cons (car q) r) 159 q (cdr q))))) 160 nil)) 161 r))) 162 163 (defun termlist-sub (ring p q 164 &aux 165 (ring (ro-ring ring-and-order)) 166 (order (ro-order ring-and-order))) 135 167 (declare (type list p q) (ring-and-order ring)) 136 168 (do (r) 137 169 ((cond 138 ((endp p) 139 (setf r (revappend r q)) t) 140 ((endp q) 141 (setf r (revappend r p)) t) 142 (t 143 (multiple-value-bind 144 (lm-greater lm-equal) 145 (funcall (ring-and-order-order ring) (termlist-lm p) (termlist-lm q)) 146 (cond 147 (lm-equal 148 (let ((s (funcall (ring-add ring) (termlist-lc p) (termlist-lc q)))) 149 (unless (funcall (ring-zerop ring) s) ;check for cancellation 150 (setf r (cons (make-term (termlist-lm p) s) r))) 151 (setf p (cdr p) q (cdr q)))) 152 (lm-greater 153 (setf r (cons (car p) r) 154 p (cdr p))) 155 (t (setf r (cons (car q) r) 156 q (cdr q))))) 157 nil)) 158 r))) 159 160 (defun termlist-sub (ring p q) 161 (declare (type list p q) (ring-and-order ring)) 162 (do (r) 163 ((cond 164 ((endp p) 165 (setf r (revappend r (termlist-uminus ring q))) 166 t) 167 ((endp q) 168 (setf r (revappend r p)) 169 t) 170 (t 171 (multiple-value-bind 172 (mgreater mequal) 173 (funcall (ring-and-order-order ring) (termlist-lm p) (termlist-lm q)) 174 (cond 175 (mequal 176 (let ((s (funcall (ring-sub ring) (termlist-lc p) (termlist-lc q)))) 177 (unless (funcall (ring-zerop ring) s) ;check for cancellation 178 (setf r (cons (make-term (termlist-lm p) s) r))) 179 (setf p (cdr p) q (cdr q)))) 180 (mgreater 181 (setf r (cons (car p) r) 182 p (cdr p))) 183 (t (setf r (cons (make-term (termlist-lm q) 184 (funcall (ring-uminus ring) (termlist-lc q))) r) 185 q (cdr q))))) 186 nil)) 170 ((endp p) 171 (setf r (revappend r (termlist-uminus ring q))) 172 t) 173 ((endp q) 174 (setf r (revappend r p)) 175 t) 176 (t 177 (multiple-value-bind 178 (mgreater mequal) 179 (funcall order (termlist-lm p) (termlist-lm q)) 180 (cond 181 (mequal 182 (let ((s (funcall (ring-sub ring) (termlist-lc p) (termlist-lc q)))) 183 (unless (funcall (ring-zerop ring) s) ;check for cancellation 184 (setf r (cons (make-term (termlist-lm p) s) r))) 185 (setf p (cdr p) q (cdr q)))) 186 (mgreater 187 (setf r (cons (car p) r) 188 p (cdr p))) 189 (t (setf r (cons (make-term (termlist-lm q) 190 (funcall (ring-uminus ring) (termlist-lc q))) r) 191 q (cdr q))))) 192 nil)) 187 193 r))) 188 194
Note:
See TracChangeset
for help on using the changeset viewer.