[Jprogramming] substring matching between two arrays

Raul Miller rauldmiller at gmail.com
Tue Nov 13 12:06:48 UTC 2018


Looking over your approach here: I would be careful of using +/ and ,
together that way. (Think about what happens when for a full name like
Joe-Joe or John Johnson.)
Thanks,
—
Raul
On Monday, November 12, 2018, Joe Bogner <joebogner at gmail.com> wrote:
> 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 <henryhrich at gmail.com> 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 <
> > > programming at jsoftware.com> 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 <schott.brian at gmail.com>
> 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


More information about the Programming mailing list

AltStyle によって変換されたページ (->オリジナル) /