[iterate-devel] destructively altering elements

Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle at t-systems.com
Wed Jun 27 10:48:48 UTC 2007


Hi,

Albert Krewinkel wrote:
>I'm doing some matrix operations and would like to use iterate for
>going through my matrices element wise.  Writing an driver to do this
>was pretty easy (great tools and manual!), but it doesn't allow me to
>alter entries in my matrix.

>(symbol-macrolet ((el (aref vec row-index col-index)))
>   (... body...))
Macrolet is a possibility, but what about writing a driver that provides
access to the 2 index variables, modeled after in-vector?
(for x in-vector foo with-index i)
(for e in-matrix foo with-indices (i j))
  (setf (aref foo i j) bar)

BTW, how do you use Iterate to walk across a 2-dimensional thing like a
matrix? This would likely involve 2 nested iterations, so any single
clause does not provide a complete solution?!?

Regards,
	Jorg Hohle



More information about the iterate-devel mailing list