I didn’t see anyone using the approach which I would think of as obvious, so:
f=: fullNames s=:shortNames ,I.|:s +./@E.&>/ f 0 0 1 2 Useful? Thanks, — Raul On Monday, November 12, 2018, Joe Bogner <[email protected]> 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
