> 0$a:  is one of those places where the implementation
doesn't match the Dictionary:

   datatype > 0$a:
boxed
   datatype (>"0) 0$a:
boolean 
   $ > 0$a:
0
   $ (>"0) 0$a:
0 0



I think it is important for $ (0$0){i. 10 to be
0 , $ 0{i. 10

and similarly for  $ (0$a:){i. 10  to be
0 , $ a:{i. 10

so I think the implementation of { is correct.



The problem, in my opinion, is in defining that two
nouns may match when they are not equivalent.  That means
that reasoning such as

    I mean  (0$0)-:0$<0  so I kind 
    > of want  ((0$0){y) -: (0$0<){y  .

which would be sensible if 'match' meant 'equivalent', is
just not valid.


; 0$a:    used to produce 0$a:, IIRC.  But that was wrong,
because ; removes a level of boxing and it should do that even
if there are no items.  So the boolean result is better.

Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bron
> Sent: Wednesday, September 27, 2006 5:55 PM
> To: Programming forum
> Subject: [Jprogramming] Dyad { with empty RHA
> 
> Is the following intentional and correct?
> 
>          $ (q =. 0$   0 ) { i. 10
>       0
>          $ (r =. 0$ < 0 ) { i. 10
>       0 10
>          
> That is, when  0-:#x  then  ( ($x) $   y) -:&$ x{y  except 
> when  32-:3!:0 x  , in which case  ( ($x) $ ,:y) -:&$ x{y  ?
> 
> I mean, it makes some sense, because when an empty  x  is 
> "open" (i.e.  q  ), then it contains 0 integers, which select 
> 0 items of  y  . 
> 
> However when  x  is "boxed"  (i.e.  r  ), the boxes that 
> aren't there are arbitrary, so to account for all the shapes 
> that could have been selected,  copies of all of  y  are provided.  
> 
> Another interpretation might be that since  32 -: 3!:0 >^:n  
> r  for any  n  ,  it could be that  {  believes  r  is trebly 
> boxed, and therefore be EXCLUDING zero items of  y  (i.e. 
> selecting all of  y  ) and reshaping THAT with the (empty) 
> shape of  x  .
> 
> But I'm not sure I like it.  I mean  (0$0)-:0$<0  so I kind 
> of want  ((0$0){y) -: (0$0<){y  .  This isn't like  -. q 
> -:&:{. r  because no fills come in to play.  Or maybe they do 
> under the covers?
> 
> Anyway, this came up with a function I believe should be a 
> tautology, but isn't:
> 
>          ravel =: {~ (<@#:  i.@:(*/) )@:$
>          check =: , -: ravel                  NB. Theoretical 
> tautology
>          check i. 10
>       1
>          check i. 10 10
>       1
>          check i. 0
>       0
>                 
> Oh, and I thought I understood:
> 
>          datatype > 0$a:  NB.  "boxed" is one way of saying 
> "the boxes could have held ANY datatype"
>       boxed
> 
> But then why:
> 
>          datatype ; 0$a:  NB.  yeah, I know a:-:<$0  but that 
> doesn't make any promises about 0$a:
>       boolean
> 
> ?
> 
> -Dan
> ----------------------------------------------------------------------
> 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