12.9. Additional Features of the Engine

At this point, we have covered the fundamentals that make a logic engine work. If you understand structures, variables, facts, rules, and programs, you can create query or logic languages that use the engine these objects create. In practice, you may want several additional features, including

  • Comparisons

  • Arithmetic

  • Evaluation

  • Not

  • Anonymous variables

  • Lists

12.9.1. Comparisons

A Comparison object compares the values of two terms. These terms can be either variables or structures, but if they are structures, they must be atoms. This restriction follows from the fact that there is no conventional way to compare two structures, such as

city(denver, 5280) 
city(richmond, 19)

If you compare these facts by an alphabetic ...

Get Building Parsers with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.