[Jprogramming] substring matching between two arrays
Raul Miller
rauldmiller at gmail.com
Mon Nov 12 21:20:55 UTC 2018
This looks like an "outer product" issue. (Try all pairs selected from the
left and right args, then assemble the result.)
Is that enough, or do you need a worked implementation?
Thanks,
—
Raul
On Monday, November 12, 2018, Joe Bogner <joebogner at gmail.com> wrote:
> I'd like to try and find all the substring matches of two arrays
>>> This is a contrived example of a larger problem
>>>> fullNames =: ('Joe B';'Joe Q';'Bobby Z';'Janet F')
>> shortNames =: ('Joe';'Bob';'Jane')
>> > fullNames
>> Joe B
>> Joe Q
>> Bobby Z
>> Janet F
>> > shortNames
>> Joe
>> Bob
>> Jane
>>> I'd like a result of something like:
>>> 0
>> 0
>> 1
>> 2
>>>> Indicating that Joe B matched Joe, Joe Q matched Joe, Bobby Z matched Bob
> and Janet matched Jane
>>>> I struggled with E. for awhile seeing if I could get it to work
>>> (,: > 0{ shortNames) E. (> fullNames)
>>> 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> But I couldn't figure out how to build upon this for all shortNames
>> Thanks,
>> Joe
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list