From what I’ve seen of Prolog, it seems as if it would be ideal for crafting a rule engine for an app. Yet, I don’t believe I’ve ever seen a rule engine written in Prolog. Is there some inherent limitation in Prolog (e. g. poor garbage collection algorithm) that would prevent it from being used to build a rule engine?
14
Rules engines in their infancy were written almost exclusively in Prolog–it was the logical language. For a small set of rules they worked great. However, it turned out they didn’t scale very well. I don’t have a definitive reference, but my understanding is that the way Prolog handles the chaining of rules is inefficient–the recursive model made for creating very large stacks that brought it to a crawl.
The development of the RETE algorithm and its successors allowed for a more efficient way to process large quantities of rules, and so took over.
Perhaps modern prolog would be more efficient than back in the 80’s, when most of the early work was done.
3
Tongue-in-cheek answer: because if the creators of Rules Engines knew about Prolog (or Mercury or PLANNER or …) they wouldn’t be writing Rules Engines, they’d be using Prolog.
Generally, the point of a rules engine is that it is a part of another application. It is rather rare to see applications written in Prolog, and there isn’t a commonly available interface to connect Prolog to applications written in other languages.
One rule-based tool for rule engines, that is written to be added to other applications, is CLIPS. CLIPS was based on OPS5 and uses the Rete algorithm for pruning rules.
4