> > > But 3 $ 1 2 3 
> > > has zero magnitude in the 2nd dimension, no? So it would 
> seem to be 
> > > equivalent 0 3 $ 1 2 3 but per the interpreter it is not.
> > 
> > It's not zero magnitude in higher dimension, it's _empty_ magnitude.
> > Same as scalar has empty dimention, but itself represents one 
> 
> I like scalar myself but "atom" is the proper J terminology. 
> I also like matrix 
> much more than array.

A matrix is a 2-D array that follows the rules of matrix multiplication
(So say I).  So a 2-D array may not be a matrix, if it contains
nonnumerics or doesn't follow matrix rules.

I think the word for a rank-2 array is 'table'.

'Array' means a noun of any rank, regrettably including 0, and so
is synonymous with 'noun'.  I wish we would agree to change
all the documentation to say that 'array' means rank
greater than 0.  I'm ready with my part.


> But why sweat the small stuff? :) And 
> list? well that 
> totally aggravates me. Vector is great. List is stepping on 
> the toes of cons 
> cells that that particular data structure.

Again, 'vector' suggests vector spaces which are numeric.

> > data location. Shape 3 is not (0,3) it's ('',3).
> 
> I see. Now, in terms of data storage:
> 
> an array of shape 1,3 can store 1 vector of magnitude 3 which 
> can store 3 
> "somethings". 
> 
> an array of shape '', 3 can store 3 somethings (it is a 
> vector of magnitude 3).
> 
> but what about an array of shape 0,3? How can you index into 
> that vector of 
> magnitude 3 and get or store data? 

A table of shape n,3 contains n items, each a list of 3 atoms.
If n is 0, the list is empty and contains no items.  But you can
add an item to it with , (as Bill pointed out).

You can't index into an array along an axis that contains a 0, because
the index must be less than the length of the corresponding axis.
Therefore you must get index error.

Consider

   $ -.~ i. 3 3
0 3

You had a table of 3 lists; you deleted some of the lists so none were left.
The shape shuld be 0 3.  It is.  This is the meaning of an empty table.

Henry Rich



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to