// file: mail3.rex // author: keller // purpose: development of a mailing list processor, step 3 // select(lists, db) creates a list of lists of individuals in the // mailing lists, excluding the names of the mailing lists select(lists, db) = map(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, map // 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" ] ];