generalised query evaluator

The make_query function evaluates a query, provided as a set of tuples (possibly containing variables, which will be matched), against a database of tuples. It returns a set of solutions -- encoded as a list of tuple lists, where each tuple list is taken from the database, and satisfies all the clauses of the query.