patch for $addrow needed?



Hello Stavros,

Concerning data sharing in matrices,

> Even though this is semantically incoherent, it is sometimes
> practically useful.

It is much more commonly the source of confusion and
frustration, so I think we really need to change it.

> Always treating matrices and their parts as fresh, unshared
> objects by copying would certainly be easy to implement.

Let's do it, then.

> However, it is inconsistent in a different way.  Consider a list
> of lists [ [ 2 ], [3, 4] ] (not a matrix).  This can be treated as a
> data structure (as opposed to a mathematical object),
> in which case it is very natural for parts of the structure to
> be shared.

I see your point, but the line between data structures and
mathematical objects is pretty blurry, so I don't think it's
practical to try to distinguish the two. A uniform policy would
be easy to explain -- I am inclined to support a policy of
never sharing data (or at least never appearing to share
data).

> A special representation would have to be
> defined for matrix columns since there is no straightforward way to
> share structure.  Other languages do support the notion of 'slices'
> (shared submatrices), some rather sophisticated.  This seems like a
> lot of complication.

I've done some work on a matrix implementation which
is an array for storage plus stride and offset for each dimension
and some other info such as a reference counter.
Slices and other operations are straightforward.
The hardest part would be just to identify all the places
in the code that look like (if (eq (caar e) '$matrix) ...) and
replace them.

all the best,
Robert Dodier