2 ms·
>> I don't know exactly what's meant by "pattern-matching facilitates indexing of rules", but I wouldn't dismiss it so quickly. Far as I can tell, "pattern-mat
by YeGoblynQueenne 9y ago
>> I don't know exactly what's meant by "pattern-matching facilitates indexing of rules", but I wouldn't dismiss it so quickly.
Far as I can tell, "pattern-matching facilitates indexing of rules" means that
the indexing scheme builds an index with a key for every instantiation pattern
of a predicate in the program database.
Prolog uses pattern matching to match a query (or a goal) to the head of a
predicate in its database. To speed things up, predicates are indexed
by their functor name (the predicate symbol) and the value of their first
argument, if it is a constant. That's all for default Prolog.
In modern Prologs keys are built for deeper patterns- more arguments, or
compound arguments at different depth etc. The particulars depend on the
implementation, but basically what I get from "pattern matching facilitates
etc" is that Picat allows indexing on multiple arguments, including compound
terms, which could enable matching the entire pattern of a query to an index key. Which is cool and all but it's not something you won't find in Prolog.
You can find details of one indexing scheme for Prolog in Swi-Prolog's
documentation on its jiti clause indexing, here:
http://www.swi-prolog.org/pldoc/man?section=jitindex http://www.swi-prolog.org/pldoc/man?section=jitindex
Hope the above makes sense- I assume some knowledge of Prolog, let me know
otherwise and I'm happy to clarify.
- ScottBurson 9y agoAh, that's interesting. I wasn't aware that modern Prologs did that much indexing, though it stands to reason that they would; I hadn't really thought about it.