Re: octothorpe array syntax; other comments Per Bothner 14 Nov 2003 22:11 UTC

bear wrote:

>   Do I understand correctly?  You mean An array of no elements, whose
> every element is an array of N elements?

No.  I means a 0*N array.

A 2-dimensional (rank 2) array is *not* the same thing as a vector of
vectors.  The implementation is obviously different, but the semantics
are also different, at least when it comes to empty arrays.

>   Why is this different from or more useful than any other kind of
> array of no elements?

If you transpose a 0*N array you get a N*0 array, which is corresponds
to a N-element vector, each of which is empty.  Sort-of.

>   I am aware that you can get such entities as a result in matrix
> operations, but I had always (perhaps mistakenly?)  regarded them as a
> degenerate case not useful for further processing, and so didn't feel
> that they needed a source syntax.

It is probably not a high priority to make a nice syntax for degeneate
arrays, as long as we have the #, syntax to fall-back on.

Common Lisp (and APL) also allow rank-0 arrays, which have a single
element.  (The total number of elements of an array is the product of
each dimension; if there are no dimensions, the product is 1.)  In APL,
a rank-0 array is equivalent to a scalar.  Common Lisp has the
read/write syntax #0a() for a rank-zero array.  A 3*0 array is #a2(() ()
()) while (if I'm reading the HperSpec right) a 0*3 is written #a2(()) -
which is ambiguous.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/