Pascal Jasmin wrote:
> I'd be comfortable if atoms were equivalent to 12
> dimensional structures with a single element.  I guess I
> need an example where the distinction matters before I
> can appreciate why it does.

"Matters"... I'm not sure what this means...

I can give you examples where a leading 1 dimension is
significant.  For example:
   (i. 3 1) +/ .* i. 1 2

Or
   (((i. 9) $each 1)$each 1) ,each <i.3

But... "matters"?  In what context?

Pascal Jasmin wrote (in a different message):
> These seem hard to understand though.
>     (i.0) $2
> 2
>    '' $ 2 3
> 2

An array without any dimensions is a scalar.

In other words, in both examples you are saying:
"Create for me an array without any dimensions based
on this other array".  In the first case the other
array is the number 2 (which doesn't already doesn't
have any dimensions, so the result is the same).
In the second case the other array is the vector
2 3 and the semantics of $ say that any extra arguments
are ignored, so you get the first item from that list.

I suspect the real issue here is that you're still
getting used to the ideas of "shape" and "rank".

To me this all seems simple and obvious, but I remember
when I was first learning it that it seemed odd -- though
even then, I didn't really have a good idea why it seemed
odd.  I guess somehow I expected that "bigger rank" always
meant "a bigger array", but that isn't necessarily the
case when the array has dimensions of 0 (or 1).

-- 
Raul

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

Reply via email to