I think I fell into the trap of thinking of / only in its monadic form. Here's a version that seems to click with me:
I."1 |: (shortNames) +/@(E. every)/ (fullNames) It uses / and takes advantage of every to mask the complexity of boxing/unboxing (at least to me). I often reach for each/every On Mon, Nov 12, 2018 at 7:14 PM Henry Rich <[email protected]> wrote: > / IS rank alone. > > x u/ y is defined as > > x u"(lu,_) y > > where lu is the left rank of u. Apply each CELL of x to the ENTIRE y. > > Henry Rich > > > On 11/12/2018 7:00 PM, Joe Bogner wrote: > > Thanks all. The solutions above were more complicated than I expected. I > > had assumed I was missing something obvious. The obvious miss was to use > / > > ... I was thinking I could do something with rank alone > > > > For comparison it is combination of map and reduce in javascript > > > > ['Joe B','Joe Q','Bobby Z','Janet F'].map(function(x) { return > > ['Joe','Bob','Jane'].reduce(function(acc,y,idx) { return > > x.indexOf(y)>=0?idx:acc },-1) }) > > > > [0, 0, 1, 2] > > > > > > > > On Mon, Nov 12, 2018 at 6:17 PM 'Mike Day' via Programming < > > [email protected]> wrote: > > > >> or this variant? > >> > >> f(1 i.~"1+./@E.~&> /)s. NB. f & s obvious? > >> 0 0 1 2 > >> > >> This lists the index of the first instance of a substring of each > element > >> of fullNames in the > >> shortNames boxed list. It assumes it's there somewhere, but you can use > >> the property > >> that non-inclusion is shown by index = length or number of shortNames. > >> > >> Any help, > >> > >> Mike > >> > >> > >>> On 12 Nov 2018, at 22:29, Brian Schott <[email protected]> wrote: > >>> > >>> Is this anything you can use? > >>> > >>> I.fullNames(((]))&: >"0/-:"1 ((#@]{.[))& >"0/) shortNames > >>> > >>> > >>> -- > >>> (B=) <-----my sig > >>> Brian Schott > >>> ---------------------------------------------------------------------- > >>> 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 > > > --- > This email has been checked for viruses by AVG. > https://www.avg.com > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
