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


Ignore:
Timestamp:
2016-05-31T12:11:19-07:00 (8 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r4009 r4010  
    615615    (with-slots (exponents)
    616616        self
    617       (cons '*
    618             (mapcan #'(lambda (var power)
    619                         (cond ((= power 0) nil)
    620                               ((= power 1) (list var))
    621                               (t (list `(expt ,var ,power)))))
    622                     vars (coerce exponents 'list)))))
     617      (let ((m (mapcan #'(lambda (var power)
     618                                 (cond ((= power 0) nil)
     619                                       ((= power 1) (list var))
     620                                       (t (list `(expt ,var ,power)))))
     621                       vars (coerce exponents 'list))))
     622        (cond ((endp (cdr m))
     623               (car m))
     624              (t
     625               (cons '* m))))))
    623626  (:method ((self term) &optional vars)
    624627    "Convert a term SELF to infix form, using variable VARS to build the representation."
     
    628631      (let ((m (call-next-method)))
    629632        (cond ((= coeff 1) m)
    630               (t (setf (cdr m) (cons coeff (cdr m)))))
     633              ((eql (car m) '*)
     634               (setf (cdr m) (cons coeff (cdr m))))
     635              (t
     636               (list* '* coeff m)))
    631637        m))))
Note: See TracChangeset for help on using the changeset viewer.