I think another way to look at this is

$,.y  is

($ 1#y),1

if $y is 0 then the result of ,.y is 0 1




----- Original Message ----
From: Henry Rich <[email protected]>
To: Programming forum <[email protected]>
Sent: Sat, June 5, 2010 3:58:52 AM
Subject: Re: [Jprogramming] ravel items (,.) of empty list (i.0)

This is tricky.

>From the Dictionary:

If y is an atom, then ,.y is 1 1$y ; otherwise, ,.y is ,"_1 y , the 
table formed by ravelling each item of y .

    $ ,"_1 i. 0
0 1

So it's right.  But why?

   In

,"_1 i. 0

the rank of ,"_1  is 0, so the verb is applied to a cell of fills.
That means that

   , 0

is executed, and this has shape 1.  The shape of the result of

   ,"_1 i. 0

then becomes this shape from the fill, prefixed by the frame of (i. 0) 
with respect to rank 0; since the shape of (i. 0) is 0, this frame is

   0

so the result shape is

   0 , 1  = 0 1

Henry Rich

Igor Zhuravlov wrote:
> Ravelling items of non-empty list is clear:
>   $ ,. 1 2 3
> 3 1
> 
> For empty list it's slightly confusing for me:
>   $ ,. i.0
> 0 1
> Answer is an empty list of lists of length 1. But shouldn't it be of shape
> (0 0) instead? Empty list has no elements, so, ravelled empty list is empty 
> list again:
>    $ , i. 0
> 0
> so the answer should be formed as empty list of empty lists.
> 
----------------------------------------------------------------------
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