Note this doesn't work if duplicates are 'consumed'; depends on the exact
problem constraints is an issue ('any two' is somewhat ambiguous). E.G.
if r contains a row 'abcabc', this routine will consider that row a match
even if l only contains one 'abc' row.
On Fri, 8 Apr 2022, Henry Rich wrote:
l =. 'abc','def',:'ghi'
l
abc
def
ghi
r =. 'abceee','defabc','mmmxxx','abcdef',:'ghidef'
r
abceee
defabc
mmmxxx
abcdef
ghidef
l (] #~ [: *./"1 (e.~ 2 3&$"1)) r
defabc
abcdef
ghidef
Henry Rich
On 4/8/2022 10:21 AM, Richard Donovan wrote:
Hi J programmers
I need help to discover the most efficient way of doing the following :-
I have two tables, on of n three-character items, and a second of m
six-character items such as…
abc,def,ghi
abceee,defabc,mmmxxx,abcdef,ghidef
I need to know which six-character items can be composed of any two
concatenated three-character items, so in the above example the required
output would be
defabc,abcdef,ghidef
There may be many thousands of entries in each tables, so an efficient
algorithm is required!
Thanks in advance
Richard Donovan
----------------------------------------------------------------------
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