close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Changeset 4445 for branches/f4grobner


Ignore:
Timestamp:
2016-06-11T08:33:20-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r4368 r4445  
    517517
    518518(defmethod shared-initialize :around ((self term) slot-names &rest initargs &key (coeff 1))
    519   "A convenience method. If a coefficient is an integer, wrap it in the INTEGER-RING object"
     519  "A convenience method. If a coefficient is an integer or rational, wrap it in
     520the INTEGER-RING or RATIONAL-FIELD object, respectively."
    520521  ;; Dispatch on the type of supplied :COEFF arg
    521522  (typecase coeff
     
    526527  ;; Now pass new initargs to the next method
    527528  (apply #'call-next-method (list* self slot-names initargs)))
     529
     530(defmethod (setf term-coeff) :after (new-value (object term))
     531  "A conveniense method. If an integer or rational value is assigned to the slot,
     532it is wrapped into an INTEGER-RING or RATIONAL-FIELD object, respectively."
     533  (with-slots (coeff)
     534      object
     535    (typecase coeff
     536      (integer
     537       (setf coeff (make-instance 'integer-ring :value coeff)))
     538      (rational
     539       (setf coeff (make-instance 'rational-field :value coeff))))))
    528540
    529541 
Note: See TracChangeset for help on using the changeset viewer.