// file: mail4.rex // author: keller // purpose: development of a mailing list processor, step 4 // select(lists, db) creates a list of individuals in the // mailing lists with no duplicates select(lists, db) = remove_duplicates( mappend(rest, keep((List) => member(first(List), lists), db))); test() = select(["cs-majors", "math-majors", "class of 00"], db); // built-in functions used: first, rest, member, keep, mappend, // remove_duplicates // db is the database of mailing lists; It is a list of lists. // Each list consists of the name of the mailing list, followed by // the individuals on the list. db = [ ["cs-majors", "mary", "john", "tom", "avi" ], ["math-majors", "alice", "tom", "franz", "yukio" ], ["class of 99", "mary", "tom", "yukio" ], ["class of 00", "john", "avi", "alice", "franz" ], ["cs-faculty", "george", "gwen", "prithi" ], ["math-faculty", "al", "gwen" ], ["curriculum-comm", "al", "prithi" ] ];