This approach is efficient because it is checking the "2 halves" of the 6char list on existence in the 3 char list, instead of permuting all combinations of 3-list items.
On Friday, April 8, 2022, 10:32:51 a.m. EDT, Henry Rich <henryhr...@gmail.com> 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