# 1. Play Matchmaker

Read（325） Label: cycle, file, import, group, select, pos,

l  Problem

Romeo is an NS GSOH M Veronian (nonsmoking, good-sense-of-humor male who lives in Verona). Juliet WLTM (would like to meet) an NS GSOH M. Will Romeo do?

The Suitor table shows the names of each suitor:

 Name Romeo Paris

The Has table (Table 7-17) shows their qualities:

 Name Has_quality Romeo NS Romeo GSOH Romeo Veronian Romeo M Paris NS Paris M ……

The Wltm table shows the features that Juliet demands:

 Name QUALITY Juliet NS Juliet GSOH Juliet M

Please find the suitors having all three qualities that Juliet required.

l  Tip

General steps: You can retrieve the qualities of each suitor first, and then cycle every suitor to compare each suitor’s qualities against the features demanded by Juliet. Finally, return the list of persons with the required qualities.

l  Code

 A 1 =file("C:\\txt\\Suitor.txt").import@t() 2 =file("C:\\txt\\has.txt").import@t() 3 =file("C:\\txt\\Wltm.txt").import@t() 4 =A2.group(Name) Group suitos by name 5 =A3.select(Name=="JULIET").(QUALITY) Qualities required by Juliet 6 =A4.select(~.(Has_Quality).pos(A5)!=null) Group of suitors meets Juliet ‘s demand 7 =A6.(Name) Return the name list of suitors meeting the requirement

l  Result