Permalink
Browse files

Fixed multiple evaluation bug in ARRAY.

  • Loading branch information...
1 parent 0dcd8fc commit fd025a788269c3f19cedde279e2e84d9282b1120 @tpapp committed Aug 31, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 let-plus.lisp
View
@@ -226,15 +226,17 @@ CONC-NAME. Read-only version."
(defmethod let+-expansion ((array array) value body)
"LET+ expansion for mapping array elements to variables."
- (let (bindings)
+ (let (bindings
+ (value-var (gensym "VALUE")))
(dotimes (row-major-index (array-total-size array))
(let ((variable (row-major-aref array row-major-index)))
(unless (ignored? variable)
(push `(,variable
- (row-major-aref ,value ,row-major-index))
+ (row-major-aref ,value-var ,row-major-index))
bindings))))
- `(progn
- (assert (equal (array-dimensions ,value) ',(array-dimensions array)))
+ `(let ((,value-var ,value))
+ (assert (equal (array-dimensions ,value-var)
+ ',(array-dimensions array)))
(let+ ,(nreverse bindings)
,@body))))

0 comments on commit fd025a7

Please sign in to comment.