- Timestamp:
- 2016-06-04T18:37:30-07:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monom.lisp
r4225 r4226 536 536 537 537 (defclass term (monom) 538 ((coeff :initarg :coeff :initform (error "Must specify coefficient.") :accessor term-coeff :type ring)) 538 ((coeff :initarg :coeff :accessor term-coeff :type ring)) 539 (:default-initargs :coeff 1) 539 540 (:documentation "Implements a term, i.e. a product of a scalar 540 541 and powers of some variables, such as 5*X^2*Y^3.")) 541 542 543 (defmethod initialize-instance :around ((self term) &rest initargs &key coeff) 544 "A convenience method. If a coefficient is an integer, wrap it in the INTEGER-RING object" 545 ;; Dispatch on supplied type of coefficient 546 (typecase coeff 547 (integer 548 (setf (getf initargs :coeff) (make-instance 'integer-ring :value coeff)))) 549 ;; Now pass new initargs to the next method 550 (apply #'call-next-method (cons self initargs))) 551 542 552 (defmethod update-instance-for-different-class :after ((old monom) (new term) &key (coeff 1)) 543 553 "Converts OLD of class MONOM to a NEW of class TERM, initializing coefficient to COEFF."
Note:
See TracChangeset
for help on using the changeset viewer.