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 3293


Ignore:
Timestamp:
2015-06-23T08:57:34-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r3292 r3293  
    8282                                     &allow-other-keys
    8383                                       )
    84   (if (eq slot-names t) (setf slot-names '(dimension exponents)))
    85   (dolist (slot-name slot-names)
    86     (case slot-name
    87       (dimension
    88        (cond (dimension-supplied-p
    89               (setf (slot-value self 'dimension) dimension))
    90              (exponents-supplied-p
    91               (setf (slot-value self 'dimension) (length exponents)))
    92              (t
    93               (error "DIMENSION or EXPONENTS must be supplied."))))
    94       (exponents 
    95        (cond
    96          (exponents-supplied-p
    97           (let ((dim (length exponents)))
    98             (when (and dimension-supplied-p (/= dimension dim))
    99               (error "EXPONENTS must have length DIMENSION"))
    100             (setf (slot-value self 'dimension) dim
    101                   (slot-value self 'exponents) (make-array dim :initial-contents exponents))))
    102          ;; when all exponents are to be identical
    103          (t
    104           (let ((dim (slot-value self 'dimension)))
    105             (setf (slot-value self 'exponents)
    106                   (make-array (list dim) :initial-element (or exponent 0)
    107                               :element-type 'exponent)))))))))
     84(flet ((slot-accessible-p (slot-name))
     85       (or (eq slot-names t) (member 'dimension slot-names)))
     86
     87  (when (and dimension-supplied-p (slot-accessible-p 'dimension))
     88      (setf (slot-value self 'dimension) dimension))
     89
     90  (when (and exponents-supplied-p (slot-accessible-p 'exponents))
     91    (let ((dim (length exponents)))
     92      (when (and dimension-supplied-p (/= dimension dim))
     93        (error "EXPONENTS must have length DIMENSION"))
     94      (setf (slot-value self 'dimension) dim
     95            (slot-value self 'exponents) (make-array dim :initial-contents exponents))
     96      (setf (slot-value self 'dimension) (length exponents))))
     97
     98  ;; when all exponents are to be identical
     99  (when (and exponent-supplied-p (slot-accessible-p 'exponents))
     100    (unless (slot-boundp self 'dimension)
     101    (error "Slot DIMENSION is unbound."))
     102    (let ((dim (slot-value self 'dimension)))
     103      (setf (slot-value self 'exponents)
     104            (make-array (list dim) :initial-element (or exponent 0)
     105                        :element-type 'exponent))))))
    108106
    109107(defmethod r-equalp ((m1 monom) (m2 monom))
Note: See TracChangeset for help on using the changeset viewer.