Changeset 873 for branches/f4grobner
- Timestamp:
- 2015-06-09T11:50:49-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monomial.lisp
r872 r873 71 71 'fixnum) 72 72 73 (defstruct (monom 74 ;; BOA constructor 75 ;; NOTE: having a non-default constructor inhibits reading via #S(...) 76 (:constructor make-monom (&key 77 (dimension nil dimension-suppied-p) 78 (initial-exponents nil initial-exponents-supplied-p) 79 (initial-exponent nil initial-exponent-supplied-p) 80 &aux 81 (dim (cond (dimension-suppied-p dimension) 82 (initial-exponents-supplied-p (length initial-exponents)) 83 (t (error "You must provide DIMENSION nor INITIAL-EXPONENTS")))) 84 (exponents (cond 85 ;; when exponents are supplied 86 (initial-exponents-supplied-p 87 (make-array (list dim) :initial-contents initial-exponents 88 :element-type 'exponent)) 89 ;; when all exponents are to be identical 90 (initial-exponent-supplied-p 91 (make-array (list dim) :initial-element initial-exponent 92 :element-type 'exponent)) 93 ;; otherwise, all exponents are zero 94 (t 95 (make-array (list dim) :element-type 'exponent :initial-element 0)))))) 96 ) 97 (exponents nil :type (vector exponent *))) 73 (defun make-monom (&key 74 (dimension nil dimension-suppied-p) 75 (initial-exponents nil initial-exponents-supplied-p) 76 (initial-exponent nil initial-exponent-supplied-p) 77 &aux 78 (dim (cond (dimension-suppied-p dimension) 79 (initial-exponents-supplied-p (length initial-exponents)) 80 (t (error "You must provide DIMENSION nor INITIAL-EXPONENTS")))) 81 (monom (cond 82 ;; when exponents are supplied 83 (initial-exponents-supplied-p 84 (make-array (list dim) :initial-contents initial-exponents 85 :element-type 'exponent)) 86 ;; when all exponents are to be identical 87 (initial-exponent-supplied-p 88 (make-array (list dim) :initial-element initial-exponent 89 :element-type 'exponent)) 90 ;; otherwise, all exponents are zero 91 (t 92 (make-array (list dim) :element-type 'exponent :initial-element 0))))) 93 monom) 98 94 99 95
Note:
See TracChangeset
for help on using the changeset viewer.