Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prolog #1183

Open
cisen opened this issue Oct 22, 2023 · 0 comments
Open

prolog #1183

cisen opened this issue Oct 22, 2023 · 0 comments

Comments

@cisen
Copy link
Owner

cisen commented Oct 22, 2023

入门案例
我们可以新建一个prolog文件

%test.pl
%在prolog中注释符为%
friend(john,julia).%声明john和julia为friend
friend(john,jack).%在prolog中用.结尾
friend(julia,sam).
friend(julia,molly).

然后在控制台中调用

?- [test].	%调用test.pl
true.
% 会遍历john、julia
?- friend(john,julia).	%查询john和julia是否为friend
true.

在上例中,friend为标识符原子,john、julia、sam等均为字符串原子。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant