The behavior should be specified in the Dictionary. If I were
writing it, it would look like this:
When all the opened boxes are empty, the type of the result is
the highest-priority type among the opened boxes, where the
type is given by the following order with the highest-priority
type listed first:
priorder =: 1 4 8 16 2 32 64 128 65536 131072
Formally, when all boxes are empty,
3!:0 ; y is priorder ([ {~ [: <./ i.) 3!:0@> y
*** end of Dictionary text ***
The current behavior is different:
etype =:
(0$0);'';(0$2);(0$4.1);(0$1j1);(0$a:);(0$1x);(0$1r2);(0$s:'`symbol');(0$u:'3')
3!:0@> etype
1 2 4 8 16 32 64 128 65536 131072
3!:0@;@,"0/~ etype
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
It makes the result Boolean always. This conflicts with the definition
of , which is:
3!:0@,&>/~ etype
1 2 4 8 16 32 64 128 65536 131072
2 2 4 8 16 32 64 128 65536 131072
4 4 4 8 16 32 64 128 65536 131072
8 8 8 8 16 8 8 8 8 8
16 16 16 16 16 16 16 16 16 16
32 32 32 8 16 32 64 128 65536 131072
64 64 64 8 16 64 64 128 65536 131072
128 128 128 8 16 128 128 128 65536 131072
65536 65536 65536 8 16 65536 65536 65536 65536 131072
131072 131072 131072 8 16 131072 131072 131072 131072 131072
I think it is a bug for these two treatments not to be identical.
The treatment I proposed above is more like , but giving priority
to 4 over 2 because I think numeric types should get the same
treatment here whether or not their value happens to be 1 or 0.
Henry Rich
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui
> Sent: Monday, October 15, 2007 9:04 AM
> To: Programming forum
> Subject: Re: RE: [Jprogramming] inverted table ifa
>
> > reliable, predictable behavior of empties
>
> So what should be the result of the following and why?
> > (3 0$0 );(0 4$'')
> > (4 0$'');(3 0$0 )
>
>
>
> ----- Original Message -----
> From: Henry Rich <[EMAIL PROTECTED]>
> Date: Monday, October 15, 2007 5:31
> Subject: RE: [Jprogramming] inverted table ifa
> To: 'Programming forum' <[email protected]>
>
> > The proper response to a question like that is "what business
> > is it of yours?". Maybe he's passing the column to some
> > verb that
> > he got from somebody else. He just wants reliable, predictable
> > behavior of empties. There shouldn't have to be any discussion
> > of motive.
> >
> > But in case he didn't get the verb from somebody else:
> >
> > {.!.0
> >
> > works to coerce an empty to numeric type.
> >
> > Henry Rich
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui
> > > Sent: Monday, October 15, 2007 8:05 AM
> > > To: Programming forum
> > > Subject: Re: [Jprogramming] inverted table ifa
> > >
> > > Why would you be doing overtake on a column of an inverted table?
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: bill lam <[EMAIL PROTECTED]>
> > > Date: Sunday, October 14, 2007 23:05
> > > Subject: Re: [Jprogramming] inverted table ifa
> > > To: Programming forum <[email protected]>
> > >
> > > > fill element.
> > > > 6{.("1) 1{:: ifa 3 2$ 'ab';''
> > > > 0 0 0 0 0 0
> > > > 0 0 0 0 0 0
> > > > 0 0 0 0 0 0
> > > >
> > > > Roger Hui wrote:
> > > > > Why does it matter what the internal type of an empty
> > array is?
> > > > >
> > > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: bill lam <[EMAIL PROTECTED]>
> > > > > Date: Sunday, October 14, 2007 19:59
> > > > > Subject: [Jprogramming] inverted table ifa
> > > > > To: Programming forum <[email protected]>
> > > > >
> > > > >> ifa
> > > > >> <@(>"1)@|:
> > > > >>
> > > > >> 3!:0&>
> > ifa 3
> > > > 2$ 'ab';''
> > > > >> 2 1
> > > > >>
> > > > >> the literal empty was changed into boolean empty. why
> > this
> > > > >> happen and how to
> > > > >> prevent it?
> > > > >>
> > > > >> (tested on both j601 and j602)
> ----------------------------------------------------------------------
> For information about J forums see
> http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm