1998 Qual

Lisp Programming Question


Give yourself 1 hour to read, think, and code a solution.


MU (Midwest University) wants your company, One Hour Software ("Done in 60 or it's yours, free!"), to develop a "citation counter" to help them evaluate candidates for tenure. Undergrads in a Lisp course have built a database of articles where each entry contains an article id, year, a list of authors, the title, and a list of the articles cited, e.g.,

(art123 1985 (smith jones) "Sanskrit for Knowledge Representation"

(art102 art256 art98))

(art124 1997 (jones) "Sanskrit for Mobile Agents"

(art102 art98 art123))

Tenure candidates are scored by how many times articles they've written are cited by other articles, but not all citations count the same. A new citation may be worth more than an old one, a citation by a co-author worth less, and a citation to oneself worth nothing. These rules change frequently. They've developed an initial rule format and example set that your program has to support:

(

((citation-by-self) => 0)

((citation-by-co-author) (citation-after 1995) => 1)

((citation-by-co-author) => 2)

((citation-after 1995) => 6)

( => 4)

)

which is meant to say:

Implement (count-citations name database) to return name's total citation score using a given article database. Focus on the rule application. Code for maintainability, extensibility, and scalability, i.e., functions should be short and coherent, new predicates should be easy to define (note that some take arguments), and the system shouldn't bog down with 1000's of article entries, as long only a small fraction involve name.