"MonkeeSage" <MonkeeSage / gmail.com> wrote in message news:1158024640.933843.82830 / i42g2000cwa.googlegroups.com... > Dave Burt wrote: >> If you want a matrix-like data structure (rather than a mathematical >> matrix), why not use an array of arrays? > > A mathematical matrix is just a dimensional arrangement of data into > "rows" and "columns", thus allowing for certain algorithmic > relationships to be defined and applied (e.g., canonical > decompositions). Every matrix (i.e., the actual matrix considered as a > complex value) is immutable and has a unique identity, just like every > number -- that's true -- but they can also be permuted or otherwise > transformed into different matrices. Why should one have to do that > constructively (i.e., construct a new matrix "from scratch"), rather > than destructively (i.e., change the existing matrix "in place"). Think > of it like this: n = 1; n = n + 1 -- even though the number 1 is > immutable and has a unique identity, the reference to it is not, and > can thus be destructively altered by assignment with the result that it > refers to new identity. It would be a pain to have to do o = n + 1, p = > n + 2 (i.e., creating new references every time the data changes), just > because 1 is immutable. Why should a matrix be any different? Mabye I'm > missing something... As far as I can tell, matrices are no different. Your example shows that 1 is immutable but references to it can be re-assigned, so you can do: n = 3 n = n + 1 Matrices are no different and, so, you can do: n = Matrix.scalar(2, 3) n = n + Matrix.I(2) In both cases, the "number" types are immutable but the references to them are not, as you say. They both work exactly the same way. What are you trying to say?