I just want to create something like: like(x,y)
.
I've been trying for a long time and am really frustrated, could anyone please tell me how to do it???!!!
相关问题
- Creating a SPARQL parameterized query using append
- How to join rules and print out outputs in prolog
- Splitting list and iterating in prolog
- Accumulating while in recursion/backtracking
- prolog trace how to use
相关文章
- What are the problems associated to Best First Sea
- How can I fix this circular predicate in Prolog?
- How to negate in Prolog
- Remove incorrect subsequent solutions without once
- prolog two lists are exactly the same
- Simplify Expressions in Prolog
- Check if any element's frequency is above a li
- Prolog — symetrical predicates
I'm assuming you are using swi interactively and trying to enter the fact gives you an error like so:
Since the fact does not exist in the database. If this is the case, try asserting the fact first:
Then you can try:
This time the query succeeds because the fact exists in the database.
A better approach might be to write your clauses into a file & then consult them. Swi prolog has an emacs-like editor that you can bring up by typing
at the prompt. Or use your own editor & then consult the file. Swi prolog comes with a lot of graphical tools that might be of help; look at the manual for more details.
You can create facts a prolog file and load them using consult function.
For example,
animals.pl
You can also use assert function to define facts in prolog terminal.
Refer this link, to get more infromation.