Wrapping Up Prolog

Prolog is one of the older languages in this book, but the ideas are still interesting and relevant today. Prolog means programming with logic. We used Prolog to process rules, composed of clauses, which were in turn composed with a series of goals.

Prolog programming has two major steps. Start by building a knowledge base, composed of logical facts and inferences about the problem domain. Next, compile your knowledge base, and ask questions about the domain. Some of the questions can be assertions, and Prolog will respond with yes or no. Other queries have variables. Prolog fills in these gaps that makes those queries true.

Rather than simple assignment, Prolog uses a process called unification that makes variables on ...

Get Seven Languages in Seven Weeks 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.