slick... virtually identical times and yours is more general and clear. thanks
(6!:2) 'idotfill (>;:''SF SY PK ... '');(5e6#(>''SF'';''SY''))' 0.150771 (6!:2) '(>;:''SF SY PK ... '') chidot (5e6#(>''SF'';''SY''))' 0.158705 On Wed, Apr 11, 2018 at 4:44 PM, Raul Miller <rauldmil...@gmail.com> wrote: > Here's what I'd start with: > > chidot=: #@[ ({. i. }.) , > > If that was too slow, I'd probably build an explicit work-alike, with > intermediate variables for shapes. > > (>;:'SF SY PK ...') chidot (>;:'SF SY') > 0 1 > > > -- > Raul > > On Wed, Apr 11, 2018 at 4:35 PM, Joe Bogner <joebog...@gmail.com> wrote: > > I often get tripped up with different trailing shapes when using i. with > > char arrays. I must not be the only one[1] > > > > Does this look like a suitable utility to deal with it or is there a more > > common way? > > > > Y1=:0&{:: > > Y2=:1&{:: > > idotfill =. (( ( (_,]) {. Y1@[) i. ((_,]) {. Y2@[) ) {:@$@Y2 >. > {:@$@Y1) f. > > > > idotfill (>'SF';'SY';'PK ');(>'SF';'SY') > > 0 1 > > > > compare with > > > > NB. different trailing shape > > (>'SF';'SY';'PK ') i. (>'SF';'SY') > > 3 3 > > > > NB. remove the trailing space on PK > > > > (>'SF';'SY';'PK') i. (>'SF';'SY') > > 0 1 > > > > > > [1] - "y must match the entire row of x (including any trailing fill > > letters) for (i.) to find it. Otherwise (i.) returns (#x) (signifying > "not > > found"), concealing your error." > > > > http://code.jsoftware.com/wiki/Vocabulary/idot#dyadic > > ---------------------------------------------------------------------- > > 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