Stavros Macrakis wrote:
> > length(row(m,1)) is 1. This is not a useful result.
>
> I'm not sure why you say it's not useful. It is at least consistent.
While it is consistent, I think the average user would be surprised by it.
I expect a single row of a matrix to be a vector.
> No, length is defined as the number of *rows* of a matrix.
Yes, I am mistaken. Perhaps the documentation for length should be updated
to indicate this.
> > Length applied to a matrix should either return
> > a list of 2 elements, or throw a exception.
>
> Yes, length could return a list of dimensions instead of an integer: so
> length(matrix([a,b,c],[d,e,f])) => [2,3], length([a,b,c]) => [3],
> length(x) => []. That would generalize nicely to arbitrary dimensions.
> But I'm not sure it should be called 'length': most uses of length want
> a single number.
Maybe it should be called mat_size as the commercial Macsyma provides
functions with matlab names, such as mat_ncols, mat_nrows and mat_size.
> Huh? In what way is it inconsistent with that?
That was related to my error about what length returns.
Dan Stanger