Why so complicated? (i.2 3) ([EMAIL PROTECTED] #: i.&,) 4 1 1
(i.2 2 3) ([EMAIL PROTECTED] #: i.&,) 4 0 1 1 --- Dan Bron <[EMAIL PROTECTED]> wrote: > Terrence: > > Bill's right. It's not clear what output you desire. That's why his result > is: > > > (i. 2 3) i."1[4 > > 3 1 > > But Devon's is: > > > (i. 2 3) ixmd 4 > > 1 1 > > Both are correct, but they're answering different questions. Here's another > possible answer: > > 4 = i. 2 3 > 0 0 0 > 0 1 0 > > Which leads directly to other formulations of Devon's ixmd : > > idx0 =. $ #: I.@:, > idx1 =. 4 $. $. > > imx0 =: idx0@:= > imx1 =: idx1@:= > > 4 imx0 i. 2 3 > 1 1 > 4 imx1 i. 2 3 > 1 1 > > Which can be extended to seeking any rectangle (cuboid) x in array y : > > > ptrn =. E.&>/@:((>. - ,)&:(#@:$) ,:@:]^:[&.> ,&:<) > > 4 idx0@:ptrn i. 2 3 > 1 1 > > > -Dan > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
