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


Ignore:
Timestamp:
2016-05-28T01:11:58-07:00 (8 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r3812 r3823  
    236236(defun divide (numerator &rest denominators)
    237237  "Non-destructively divide object NUMERATOR by product of DENOMINATORS."
    238   (divide-by (copy-instance numerator) (apply #'multiply denominators)))
     238  (cond ((endp denominators)
     239         (divide-by 1 numerator))
     240        (t (divide-by (copy-instance numerator) (apply #'multiply denominators)))))
    239241
    240242(defgeneric divides-p (object1 object2)
     
    392394(defun make-monom-constant (dimension)
    393395  (make-instance 'monom :dimension dimension))
    394 
    395 (defgeneric ->list (object)
    396   (:method ((m monom))
    397     "A human-readable representation of a monomial M as a list of exponents." 
    398     (coerce (monom-exponents m) 'list)))
    399396
    400397;; pure lexicographic
     
    596593  (:method ((self term))
    597594    (universal-zerop (term-coeff self))))
     595
     596(defgeneric ->list (self)
     597  (:method ((self monom))
     598    "A human-readable representation of a monomial SELF as a list of exponents." 
     599    (coerce (monom-exponents self) 'list))
     600  (:method ((self term))
     601    "A human-readable representation of a term SELF as a cons of the list of exponents and the coefficient."
     602    (cons (coerce (monom-exponents m) 'list) (term-coeff m))))
Note: See TracChangeset for help on using the changeset viewer.