So, a revised version of trim with (2 0 1&|:) does work as this example shows. But it must have been a coincidence that (0 1&|:) worked without currying tess to (cp;._3)? There stills seems something peculiar here.
trimhbr =: tess&(cp ;._3)"2 &.(2 0 1&|:) trimhbr i. 7 10 3 33 34 35 42 43 44 51 52 53 123 124 125 132 133 134 141 142 143 On Fri, Jun 2, 2017 at 6:51 AM, Raul Miller <[email protected]> wrote: > debug/dissect should explain the error, but unfortunately it errors out, > itself. > > Still, hopefully this makes sense: > > 2 0 1&|: tess > |index error > | 2 0 1&|:tess > > -- > Raul > > > > On Fri, Jun 2, 2017 at 5:42 AM, Brian Schott <[email protected]> > wrote: > > Bob, > > > > I found some interesting/surprising results by delving further into your > > analysis. > > > > First, this looks like what Henry had in mind. > > > > tess cp;._3"2&.( 0 1&|:)i.7 10 3 > > 33 34 35 > > 42 43 44 > > 51 52 53 > > > > 123 124 125 > > 132 133 134 > > 141 142 143 > > > > But even though the following two transposes seems identical there is a > > later surprise. > > > > (2 0 1&|: -: 0 1&|:) i. 7 10 3 > > 1 > > > > And here is an unexpected surprise. Why is this an error. > > > > tess cp;._3"2&.(2 0 1&|:)i.7 10 3 > > |index error > > | tess cp;._3"2&.(2 0 1&|:)i.7 10 3 > > > > Second, to return to the timing issue, Henry's approach does seem to be > > (much) faster. > > > > trimhb =: tess&(cp ;._3)"2 &.(0 1&|:) > > 100000 timespacex 'trimhb i. 7 10 3' > > 2.84443e_5 31744 > > 100000 timespacex 'trimalt i. 7 10 3' > > 3.79653e_6 7040 > > > > Third, one more observation that is somewhat irrelevant, but neat, > involves > > the intelligence of the j interpreter in this case. Look at the > > (intelligence of?) the last line below where the boxed portion is > > translated to display in linear representation (provided 9!:3]5 is set). > > > > tr i. 7 10 3 > > +-----------+ > > |+---+-----+| > > ||1 4|1 4 7|| > > |+---+-----+| > > +-----------+ > > (tr i. 7 10 3)&{ > > (<1 4;1 4 7)&{ > > (tr i. 70 100 3)&{ > > (<(1+3*i.23);1+3*i.33)&{ > > > > And thank you for the detailed explanation you provided. > > > > The beat goes on ... > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- (B=) <-----my sig Brian Schott ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
