Prolog Tutorial 1

来源:互联网 发布:命运 知乎 编辑:程序博客网 时间:2024/05/29 08:51

Prolog is a logical language which can help us to check the relation among propositions.

First, we should write prolog in a file named xxxx.pl. Then after installing prolog, we can just type prolog in terminal to launch prolog.

To load the file that we wrote is quite simple. We can just write [“name.pl”]. in terminal. Then prolog will automatically load the file.

Then, let’s move to the next.
We can write

likes(me, programming).likes(me, C++).likes(me, Microsoft).

It means I like programming, I like C++, I like Microsoft. Attention, just like other programming languages, we should have a terminator at the end of a phase. In prolog, the terminator is a point ” . “. We have to add a point at the end of any instruction.

0 0