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