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 2004


Ignore:
Timestamp:
2015-06-16T17:14:41-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/pol.lisp

    r2003 r2004  
    100100
    101101(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))
    122105
    123106(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)))
    131108
    132109(defmethod poly-add ((p poly) (q poly)))
     
    151128    ((null expr)
    152129     (error "Empty expression"))
    153     ((eql expr 0) (make-poly-zero))
     130    ((eql expr 0)
     131     (make-poly-zero))
    154132    ((member expr vars :test #'equalp)
    155133     (let ((pos (position expr vars :test #'equalp)))
Note: See TracChangeset for help on using the changeset viewer.