Changeset 2213
- Timestamp:
- 2015-06-18T10:33:28-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monom.lisp
r2212 r2213 65 65 66 66 (defmethod initialize-instance :after ((self monom) 67 &key68 69 70 67 &key 68 (dimension nil dimension-suppied-p) 69 (exponents nil exponents-supplied-p) 70 (exponent nil exponent-supplied-p)) 71 71 "A constructor (factory) of monomials. If DIMENSION is given, a 72 72 sequence of DIMENSION elements of type EXPONENT is constructed, where … … 74 74 to 0. Alternatively, all elements may be specified as a list 75 75 EXPONENTS." 76 (setf (slot-value self 'dimension) (cond (dimension-suppied-p 77 dimension) 78 (exponents-supplied-p 79 (length exponents)) 80 (t 81 (error "You must provide DIMENSION or EXPONENTS"))) 82 (slot-value self 'exponents) (cond 83 ;; when exponents are supplied 84 (exponents-supplied-p 85 (when (and dimension-suppied-p 86 (/= dimension (length exponents))) 87 (error "EXPONENTS must have length DIMENSION")) 88 (make-array (list dimension) :initial-contents exponents 89 :element-type 'exponent)) 90 ;; when all exponents are to be identical 91 (exponent-supplied-p 92 (make-array (list dimension) :initial-element exponent 93 :element-type 'exponent)) 94 ;; otherwise, all exponents are zero 95 (t 96 (make-array (list dimension) :element-type 'exponent :initial-element 0))))) 76 (format t "INITIALIZE-INSTANCE called with SELF ~A, DIMENSION ~A, EXPONENTS ~A, EXPONENT ~A.~%" 77 self dimension exponents exponent) 78 (let ((new-dimension (cond (dimension-suppied-p dimension) 79 (exponents-supplied-p 80 (length exponents)) 81 (t 82 (error "You must provide DIMENSION or EXPONENTS")))) 83 (new-exponents (cond 84 ;; when exponents are supplied 85 (exponents-supplied-p 86 (make-array (list dimension) :initial-contents exponents 87 :element-type 'exponent)) 88 ;; when all exponents are to be identical 89 (exponent-supplied-p 90 (make-array (list dimension) :initial-element exponent 91 :element-type 'exponent)) 92 ;; otherwise, all exponents are zero 93 (t 94 (make-array (list dimension) :element-type 'exponent :initial-element 0))))) 95 )) 97 96 98 97 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Note:
See TracChangeset
for help on using the changeset viewer.