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.
Line | |
---|
1 | (in-package "POLYNOMIAL")
|
---|
2 |
|
---|
3 | (defgeneric static-sugar (object)
|
---|
4 | (:documentation "Return statically calculated sugar of object OBJECT. That is,
|
---|
5 | the sugar value which does not assume that the object is a result of any prior calculations.")
|
---|
6 | (:method ((object monom))
|
---|
7 | (total-degree object))
|
---|
8 | (:method ((object poly))
|
---|
9 | (with-slots (termlist)
|
---|
10 | object
|
---|
11 | (loop for trm in termlist maximize (sugar trm)))))
|
---|
12 |
|
---|
13 | (defclass sugar ()
|
---|
14 | ((value :initarg :value :initform -1 :accessor sugar-value :type fixnum)))
|
---|
15 |
|
---|
16 | (defclass monom-with-sugar (monom sugar) ())
|
---|
17 |
|
---|
18 | (defmethod shared-initialize :after ((self monom-with-sugar) slot-names &rest initargs &key)
|
---|
19 | "Initialize sugar value based on the exponents"
|
---|
20 | (declare (ignore slot-names initargs))
|
---|
21 | (setf (slot-value self 'value) (sugar self)))
|
---|
22 |
|
---|
23 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.
Download in other formats: