I do not think Don's original problem had anything to do with ; but with the append. The raze only contributes because it can change the rank of the object appended.

Following the Dictionary in a different case

  (i.2 4) , i.0
0 1 2 3
4 5 6 7
0 0 0 0

Adding what looks like something that is empty, adds an item to the array. Append first constructs an item by moving to rank 1,It then pads using fill elements to the shape of the items of the left argument. Note the difference with

   (i.2 4) , i. 0 2
0 1 2 3
4 5 6 7

For a rank 3 array we get

  (i. 2 3 4) , i. 0 2
0  1  2  3
4  5  6  7
8  9 10 11

12 13 14 15
16 17 18 19
20 21 22 23

0  0  0  0
0  0  0  0
0  0  0  0

  (i.2 3 4),i. 0 0 0
0  1  2  3
4  5  6  7
8  9 10 11

12 13 14 15
16 17 18 19
20 21 22 23

Don's final question in his first post was the correct question. The effect of appending an empty array depends on the shape of both the arguments. ----- Original Message ----- From: "Henry Rich" <[EMAIL PROTECTED]>
To: "'Programming forum'" <[email protected]>
Sent: Sunday, June 29, 2008 5:49 PM
Subject: RE: [Jprogramming] Extra empty item from an empty table


It's not raze that loses the structure.  raze makes a
list of items: all structure in the ITEMS is preserved.

The problem is that when a list of boxes goes empty, the
structure inside the boxes is lost.

When you have

< 2 5 $ 6

the box contains a table.  If you have a list of such boxes,
each holds a table.  If you use ; on such a boxed list, the
structure of the contents will be revealed.

But when you have a 0-length array of such things, they are
no longer (a list of 0) boxes containing tables, but
(a list of 0) boxes containing empty lists.

You could imagine having empty lists contain structure, but
apparently APL variants tried that and the results were bad.

The bottom line: when you have boxes containing tables, you must
treat the empty-list-of-boxes as a special case.

Henry Rich

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Don Guinn
Sent: Saturday, June 28, 2008 11:16 PM
To: Programming forum
Subject: Re: [Jprogramming] Extra empty item from an empty table

What trapped me was that I used

   $0#i.1 2
0 2

quite a lot and it keeps structure. But raze does not.  Thanks.

2008/6/28 Henry Rich <[EMAIL PROTECTED]>:

> The problem is that you have a box containing structure
> (rank-2 arrays).  When you raze them, you keep some of that
structure.
> But when you have 0 of the boxes, you lose the internal structure;
> the boxed empty is always treated like the contents are 0$0 .
>
> ;(<2 2$;:'abc de fg h'),<0#,:;:'ww xxxx'
>
> is equivalent to
>
> (2 2$;:'abc de fg h'),0#,:;:'ww xxxx'
>
>
> Note the subtle difference in boxing between this and your
first failing
> case.
>
> Henry Rich
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Don Guinn
> > Sent: Saturday, June 28, 2008 9:46 PM
> > To: Programming forum
> > Subject: Re: [Jprogramming] Extra empty item from an empty table
> >
> > Thank you for your comments. After reading the dictionary
on Raze (;)
> > several times I see why it didn't work. However, after
> > fooling around some
> > more I found what did work as I wanted. Need to spend a
> > little time really
> > understanding it.
> >
> >    ;(<2 2$;:'abc de fg h'),<1#,:;:'ww xxxx'
> > +---+----+
> > |abc|de  |
> > +---+----+
> > |fg |h   |
> > +---+----+
> > |ww |xxxx|
> > +---+----+
> >    ;(<2 2$;:'abc de fg h'),<0#,:;:'ww xxxx'
> > +---+--+
> > |abc|de|
> > +---+--+
> > |fg |h |
> > +---+--+
> >
> >
> >  On Sat, Jun 28, 2008 at 4:37 PM, Fraser Jackson
> > <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > The following may be a simpler example of your problem.
> > >
> > >  (2 2$;:'abc de fg h'),0$1 2 $a:
> > > ----T--┐
> > > │abc│de│
> > > +---+--+
> > > │fg │h │
> > > L---+---
> > >  (2 2$;:'abc de fg h'),0 2$a:
> > > ----T--┐
> > > │abc│de│
> > > +---+--+
> > > │fg │h │
> > > L---+---
> > >  (2 2$;:'abc de fg h'),0$a:
> > > ----T--┐
> > > │abc│de│
> > > +---+--+
> > > │fg │h │
> > > +---+--+
> > > │   │  │
> > > L---+---
>  > >
> > >
> > > ----- Original Message ----- From: "Don Guinn"
<[EMAIL PROTECTED]>
> > > To: "Programming forum" <[email protected]>
> > > Sent: Sunday, June 29, 2008 9:20 AM
> > > Subject: [Jprogramming] Extra empty item from an empty table
> > >
> > >
> > >> Was doing some recursive directory searches and needed to
> > combine the
> > >> results from multiple directories but when a directory did
> > not find any
> > >> items I got an item of nulls. Looking at the example shown
> > below, I don't
> > >> think I should get the item of nulls.
> > >>
> > >>  (2 2$;:'abc de fg h'),;2#<,:;:'ww xxxx'
> > >> +---+----+
> > >> |abc|de  |
> > >> +---+----+
> > >> |fg |h   |
> > >> +---+----+
> > >> |ww |xxxx|
> > >> +---+----+
> > >> |ww |xxxx|
> > >> +---+----+
> > >>  (2 2$;:'abc de fg h'),;1#<,:;:'ww xxxx'
> > >> +---+----+
> > >> |abc|de  |
> > >> +---+----+
> > >> |fg |h   |
> > >> +---+----+
> > >> |ww |xxxx|
> > >> +---+----+
> > >>  (2 2$;:'abc de fg h'),;0#<,:;:'ww xxxx'
> > >> +---+--+
> > >> |abc|de|
> > >> +---+--+
> > >> |fg |h |
> > >> +---+--+
> > >> |   |  |
> > >> +---+--+
> > >>
> > >> Why is there a third item which is empty in the last case? Am I
> > >> misunderstanding something about append?
> > >>
> >
----------------------------------------------------------------------
> > >> 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
>
>


----------------------------------------------------------------------
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