Zeros in the shape are a bit strange, yes. If the only zero is in the
last element of the shape you will a blank line (or blank lines) based
on the rest of the shape, but you have no idea of rank. If you have
any zeros anywhere else in the shape you will get an entirely empty
display which conveys nothing at all about the rank (other than that
it is greater than 1).

In other words, these display the same:
   i. 0 1 0 1 0
   i. 5 0 2
   i. 99999 0 2
   i. 0 0 0 0 0 0 0 0 0 0 0 0 0

Of course you will also get an error if you try to combine one of
those with another array of the wrong shape. Error conditions are one
of the cases where I like getting the shapes of arrays.

One of my favorite tricks, if I am getting an error from an expression
that seems to be due to of a lack of shapeliness (like a length error)
is to replace the last verb with $ (or a variation like ;&$ or $&.> or
;&($ L:0) or whatever else).

And that brings up another issue related to finding the shapes of
things: the shape inside a box will typically be different from the
shape outside the box (these shapes are "independent" of each other).
Also, the shape of transitory arrays (intermediate results) can also
matter. So familiarity with debugging tools and techniques can be
crucial - sometimes even more important for coding than familiarity
with shape and rank issues. (These are not, properly speaking, a part
of the language itself so much as they are a part of the environment.
But that's something of a technicality.)

Thanks,

-- 
Raul


On Tue, Feb 4, 2014 at 1:59 AM, robert therriault <bobtherria...@mac.com> wrote:
> Raul,
>
> One of the challenges I have found is in shapes with more than one zero 
> value, because that second layer of nothingness is difficult to distinguish. 
> I think by enclosing the shapes appropriately, this can be done, but not by 
> text alone.
>
> It reminds me of the last verse of "The Snow Man" by Wallace Stevens.
>
> For the listener, who listens in the snow,
> And, nothing himself, beholds
> Nothing that is not there and the nothing that is.
>
> Cheers, bob
>
> On Feb 3, 2014, at 5:10 PM, Raul Miller <rauldmil...@gmail.com> wrote:
>
>> On Mon, Feb 3, 2014 at 6:19 PM, Pascal Jasmin <godspiral2...@yahoo.ca> wrote:
>>> In terms of distinguishing arrays, the key visual effect should be based on 
>>> "is there some leading unobvious rank information?"
>>
>> More specifically, leading 1 dimensions are invisible (and so is "type
>> information"), by default.
>>   (i.6)+i.1 1 1 1 6
>> |length error
>>
>>   i.6
>> 0 1 2 3 4 5
>>   i.1 1 1 1 6
>> 0 1 2 3 4 5
>>   ":i.6
>> 0 1 2 3 4 5
>>
>> Any other leading dimension is visible (well, except for 0s in the
>> shape, but that's somewhat visible, in a sense, because you can tell
>> that you are not seeing any data).
>>
>> Thanks,
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to