order of solutions on backtracking
Fernando Guzmán <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
I have a database consisting, among other things, of a large number of facts with different predicates. I need to run a query that can be satisfied either by pred1(arguments) or pred2(arguments). If I submit the query: ?- pred1(arguments); pred2(arguments). on backtracking, this will generate all solutions with pred1 first, and then all solutions with pred2. What I need is all the solutions with either predicate in the PRECISE order in which they appear in the database. One way to accomplish this would be using clause/3 to get the references for all solutions, then use clause_property/2 to get their location within the file, and sort them by location. My question here is this: is there a "cleaner/more elegant" solution to this problem? -- Fernando Guzman [email protected] -------------- next part -------------- HTML attachment scrubbed and removed