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 4168


Ignore:
Timestamp:
2016-06-03T02:01:04-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r4130 r4168  
    625625    (cons (coerce (monom-exponents self) 'list) (term-coeff self))))
    626626
    627 (defgeneric ->sexp (self &optional vars)
    628   (:documentation "Convert a polynomial SELF to an S-expression, using variables VARS.")
    629   (:method :before ((self monom) &optional vars)
    630            "Check the length of variables VARS against the length of exponents in SELF."
     627(defgeneric ->sexp (object &optional vars)
     628  (:documentation "Convert a polynomial OBJECT to an S-expression, using variables VARS.")
     629  (:method :before ((object monom) &optional vars)
     630           "Check the length of variables VARS against the length of exponents in OBJECT."
    631631           (with-slots (exponents)
    632                self
     632               object
    633633             (assert (= (length vars) (length exponents))
    634634                     nil
    635635                     "Variables ~A and exponents ~A must have the same length." vars exponents)))
    636   (:method ((self monom) &optional vars)
    637     "Convert a monomial SELF to infix form, using variable VARS to build the representation."
     636  (:method ((object monom) &optional vars)
     637    "Convert a monomial OBJECT to infix form, using variable VARS to build the representation."
    638638    (with-slots (exponents)
    639         self
     639        object
    640640      (let ((m (mapcan #'(lambda (var power)
    641641                                 (cond ((= power 0) nil)
     
    647647              (t
    648648               (cons '* m))))))
    649   (:method ((self term) &optional vars)
    650     "Convert a term SELF to infix form, using variable VARS to build the representation."
     649  (:method :around ((object term) &optional vars)
     650    "Convert a term OBJECT to infix form, using variable VARS to build the representation."
    651651    (declare (ignore vars))
    652     (with-slots (exponents coeff)
    653         self
    654       (let ((m (call-next-method)))
    655         (cond ((eql coeff 1) m)
    656               ((atom m)
    657                (cond ((eql m 1) coeff)
    658                      (t (list '* coeff m))))
    659               ((eql (car m) '*)
    660                (list* '* coeff (cdr m)))
     652    (with-slots (coeff)
     653        object
     654      (let ((sexp (call-next-method)))
     655        (cond ((eql coeff 1) sexp)
     656              ((atom sexp)
     657               (cond ((eql sexp 1) coeff)
     658                     (t (list '* coeff sexp))))
     659              ((eql (car sexp) '*)
     660               (list* '* coeff (cdr sexp)))
    661661              (t
    662                (list '* coeff m)))))))
     662               (list '* coeff sexp)))))))
Note: See TracChangeset for help on using the changeset viewer.