Changeset 2204 for branches/f4grobner
- Timestamp:
- 2015-06-18T09:28:59-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monom.lisp
r2203 r2204 66 66 (defmethod make-instance :before ((self monom) 67 67 (dimension nil dimension-suppied-p) 68 ( initial-exponents nil initial-exponents-supplied-p)69 ( initial-exponent nil initial-exponent-supplied-p))68 (exponents nil exponents-supplied-p) 69 (exponent nil exponent-supplied-p)) 70 70 "A constructor (factory) of monomials. If DIMENSION is given, a 71 71 sequence of DIMENSION elements of type EXPONENT is constructed, where 72 individual elements are the value of INITIAL-EXPONENT, which defaults72 individual elements are the value of EXPONENT, which defaults 73 73 to 0. Alternatively, all elements may be specified as a list 74 INITIAL-EXPONENTS."74 EXPONENTS." 75 75 (with-slots (dimension exponents) 76 76 self 77 77 (setf dimension (cond (dimension-suppied-p dimension) 78 ( initial-exponents-supplied-p (length initial-exponents))79 (t (error "You must provide DIMENSION or INITIAL-EXPONENTS")))78 (exponents-supplied-p (length exponents)) 79 (t (error "You must provide DIMENSION or EXPONENTS"))) 80 80 exponents (cond 81 81 ;; when exponents are supplied 82 ( initial-exponents-supplied-p83 (when (and dimension-suppied-p (/= dimension (length initial-exponents)))84 (error " INITIAL-EXPONENTS must have length DIMENSION"))85 (make-array (list dimension) :initial-contents initial-exponents82 (exponents-supplied-p 83 (when (and dimension-suppied-p (/= dimension (length exponents))) 84 (error "EXPONENTS must have length DIMENSION")) 85 (make-array (list dimension) :initial-contents exponents 86 86 :element-type 'exponent)) 87 87 ;; when all exponents are to be identical 88 ( initial-exponent-supplied-p89 (make-array (list dimension) : initial-element initial-exponent88 (exponent-supplied-p 89 (make-array (list dimension) :element exponent 90 90 :element-type 'exponent)) 91 91 ;; otherwise, all exponents are zero 92 92 (t 93 (make-array (list dimension) :element-type 'exponent : initial-element 0)))))93 (make-array (list dimension) :element-type 'exponent :element 0))))) 94 94 (call-next-method)) 95 95
Note:
See TracChangeset
for help on using the changeset viewer.