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 4530 for branches


Ignore:
Timestamp:
2016-06-17T18:45:17-07:00 (8 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial-sugar.lisp

    r4524 r4530  
    3232           "ADD-TO"
    3333           "MULTIPLY-BY"
     34           "MAKE-UNIT-FOR"
    3435           )
    3536  (:documentation "Implements 'sugar'."))
     
    4849  (:method ((object poly))
    4950    "Static sugar of a poly OBJECT is the maximum sugar of its terms."
    50   (with-slots (termlist)
     51  (with-accessors ((termlist poly-termlist))
    5152        object
    5253      (loop for trm in termlist maximize (static-sugar trm)))))
     
    6869  "Initialize sugar value based on the exponents."
    6970  (declare (ignore slot-names initargs))
    70   (setf (slot-value self 'value) (static-sugar self)))
     71  (with-slots (value)
     72      self
     73    (setf value (static-sugar self))))
    7174
    7275(defmethod update-instance-for-different-class :after ((old monom) (new monom-with-sugar) &key)
     
    102105(defmethod shared-initialize :after ((self term-with-sugar) slot-names &rest initargs &key)
    103106  (declare (ignore slot-names initargs))
    104   (setf (slot-value self 'value) (static-sugar self)))
     107  (with-slots (value)
     108      self
     109    (setf value (static-sugar self))))
    105110
    106111
     
    124129  "Initialize sugar to its static value, which is the maximum of sugar values of the terms."
    125130  (declare (ignore slot-names initargs))
    126   (setf (slot-value self 'value) (static-sugar self)))
     131    (setf (slot-value self 'value) (static-sugar self)))
    127132
    128133(defmethod update-instance-for-different-class :after ((old poly) (new poly-with-sugar) &key)
     
    162167      (setf value (max value other-value))))
    163168  self)
     169
     170(defmethod make-unit-for ((object poly-with-sugar))
     171  (change-class (call-next-method) 'poly-with-sugar))
Note: See TracChangeset for help on using the changeset viewer.