Changeset 2004 for branches/f4grobner
- Timestamp:
- 2015-06-16T17:14:41-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/pol.lisp
r2003 r2004 100 100 101 101 (defclass poly () 102 ((termlist :initarg :termlist :accessor termlist)) 103 (:default-initargs :termlist nil)) 104 105 (defun make-poly-from-termlist (termlist) 106 (make-instance 'poly :termlist termlist :sugar sugar)) 107 108 (defun make-poly-zero (&aux (termlist nil) (sugar -1)) 109 (make-instance 'poly :termlist termlist)) 110 111 (defun make-poly-variable (ring nvars pos &optional (power 1) 112 &aux 113 (termlist (list 114 (make-term-variable ring nvars pos power)))) 115 (make-instance 'poly :termlist termlist)) 116 117 (defun poly-unit (ring dimension 118 &aux 119 (termlist (termlist-unit ring dimension))) 120 (make-instance 'poly :termlist termlist)) 121 102 ((expr :initarg :expr :accessor expr)) 103 ((vars :initarg :vars :accessor vars)) 104 (:default-initargs :expr 0 :vars nil)) 122 105 123 106 (defmethod print-object ((self poly) stream) 124 (princ (slot-value self 'termlist))) 125 126 (defmethod poly-termlist ((self poly)) 127 (slot-value self 'termlist)) 128 129 (defmethod (setf poly-termlist) (new-value (poly poly)) 130 (setf (slot-value poly 'termlist) new-value)) 107 (princ (slot-value self 'expr))) 131 108 132 109 (defmethod poly-add ((p poly) (q poly))) … … 151 128 ((null expr) 152 129 (error "Empty expression")) 153 ((eql expr 0) (make-poly-zero)) 130 ((eql expr 0) 131 (make-poly-zero)) 154 132 ((member expr vars :test #'equalp) 155 133 (let ((pos (position expr vars :test #'equalp)))
Note:
See TracChangeset
for help on using the changeset viewer.