- 参考网址:http://www0.cs.ucl.ac.uk/staff/mahmed/teaching/intro.html
- 参考网址:http://www.swi-prolog.org/build/Debian.html
- 安装
% sudo apt-add-repository ppa:swi-prolog/stable % sudo apt-get update % sudo apt-get install swi-prolog
2. 检测ubuntu 版本的方法 :打开 terminal 输入 swipl --version
3. 检索方法:
by loading a database (your program) holding the facts and rules you want to use with; ['progName.pl'] or compile('progName.pl') or consult('progName.pl'), for example
| ?- ['family.pl']. |
| ?- compile('family.pl'). |
| ?- consult('family.pl'). |
注意:一定在结尾处有 "."
4. 退出方法:
| ?- halt. |
| <Ctrl>+<D> |
5.查询方法:
The listing command can be used to list the predicates that you have specified in your program or those in to the built in the interpreter, for example:
?- listing(grandparent).
grandparent(X, Y) :-
parent(X, Z),
parent(Z, Y).
Yes
|