4 ms·
> Probably better to use modern Prolog instead? Caveat first off: it's 7+ years since I looked at this, so take "modern" in that context. I used SWI Prolog sp
by spinningslate 7y ago
> Probably better to use modern Prolog instead?
Caveat first off: it's 7+ years since I looked at this, so take "modern" in that context. I used SWI Prolog specifically [1].
At that point, CLIPS and Prolog occupied similar spaces - but not the same. Prolog is backward chaining. So it's really good at answering questions that can be derived from a base set of facts. For example. Let's say:
There's a road from City A to City B, and a road from City B to City C.
It's then very easy in Prolog to say "there's a route from "Start" to "Finish" if either:
1. there's a road from Start to Finish, or
2. There's a road from Start to City X, and a route from X to Finish.
The beauty of prolog is that you don't need to explicitly code iteration over all the available roads; that's what the backward chaining algorithm does for you.
In arriving at the answer, it'll exhaustively test all permutations. Importantly though, it won't add to the list of facts you started with (unless you specifically tell it to). Once the question is answered, the intermediate results are discarded. In that sense, Prolog - at least in purest form - is somewhat stateless. Assert some facts, then ask questions about inferences that can be drawn from them.
CLIPS is different. It's a forward chaining engine, from a class of related products known as Production Systems. It's designed to be used where new facts are being asserted; when that happens, it figures out the consequences as they ripple through. As new facts are asserted - and their consequences computed - the underlying state evolves. So intermediate results are retained (in fact, that's key to operation).
CLIPS (and Production Systems in general) were used, for example, in medical diagnosis applications. As new symptoms were asserted, the rules rippled through, suggesting the most likely diagnosis.
The key to making this efficient is the forward chaining algorithm, known as Rete [2] (pronounced "Rait").
Again: these are examples, and the reality is likely much more nuanced now. But at least in their purest original form, CLIPS and Prolog are more complementary than overlapping.
[1] http://www.swi-prolog.org/ http://www.swi-prolog.org/
[2] https://en.wikipedia.org/wiki/Rete_algorithm https://en.wikipedia.org/wiki/Rete_algorithm
EDIT: minor grammar changes + clarified naming in Prolog example.