Commit e85d75dc authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Fix iterate extension to increment properly

In the iterate extension :matrix-element, the first element of
following rows was repeated due to an error in the logic of the
expansion. 
Example: 
(defparameter m1 #m(1 2 3 ^ 0 6 8))
(iter:iter (iter:for e :matrix-element m1) (princ e) (princ " "))
1.0 2.0 3.0 0.0 0.0 6.0 8.0
This is now fixed.

Problem reported on SO, and sent to mailing list by Joshua Taylor.
parent 8644ef5c
Loading
Loading
Loading
Loading
+26 −24
Original line number Diff line number Diff line
;; Iterate
;; Norman Werner 2009-05-26 22:23:40EDT iterate.lisp
;; Time-stamp: <2011-08-20 17:36:47EDT iterate.lisp>
;; Time-stamp: <2013-06-23 22:46:42EDT iterate.lisp>
;;
;; Copyright 2009 Norman Werner, Liam M. Healy
;; Copyright 2009, 2013 Norman Werner, Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
@@ -98,7 +98,9 @@ As an example try:
		      (incf ,row-index)
		      (if (>= ,row-index ,row-size)
			  (terminate)
			    (grid:aref ,m ,row-index ,col-index)))
			  (prog1
			      (grid:aref ,m ,row-index ,col-index)
			    (incf ,col-index))))
		    (prog1
			(grid:aref ,m ,row-index ,col-index)
		      (incf ,col-index))))))))