>a lot of J must be taught - when the representation for an empty list
>and a rank-1 array of shape 0 are both blank lines...

The display should be the same:  a rank-1 array of shape  ,0   _is_ an empty 
list.  If we use the narrower definition of list given in 
http://www.jsoftware.com/help/dictionary/dicta.htm  :

           1120 77 qdoj 'dicta'  NB.  Section A:  Nouns
        Arrays of ranks 0, 1, and 2 are 
        also called atom, list, and table

Then _only_ rank-1 arrays of shape  ,0  are empty lists.  If we use the broader 
sense of list, as in "every array is a list of items", then any array with 0 
items an empty list.  But then, not all arrays with tally zero display the same 
way:

           < i. 0 
        ++
        ||
        ++
           < i. 0 0
        ++
        ++

(the boxes just make obvious the difference in display)

That is, empty rank-1 arrays display 1 blank line, empty not-rank-1 arrays 
display 0 (blank) lines.  Here, empty means "no items", not "no atoms".  Some 
arrays with items but no atoms (zero volume) display blank lines:

           < i. 1 0 
        ++
        ||
        ++

The justification for this is that a rank-1 array is one line; one line with no 
0-cells is a blank line.  A higher ranked array has one line for each of its 
1-cells.  No 1-cells means no lines.  A higher ranked array with 1-cells but no 
0-cells has 1 blank line per 1-cell.


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

Reply via email to