问题描述
我在看书时遇到了问题.我看到一个程序使用谓词简单"(我猜 simple/1
).不知道这个谓词是什么意思,在控制台用 ?-help(simple)
找不到.但是当我在控制台中尝试一些查询时,它的工作方式类似于:
I run into problem while reading a book.I see a program use predicate "simple" ( I guess simple/1
). I don't know what is the meaning of this predicate, I can't find it with ?-help(simple)
in the console.But when I tried with some queries in console, it worked something like:
5 ?- simple(p(x)).
false.
6 ?- simple(mia).
true.
7 ?- simple(Mia).
true.
8 ?- simple(f(Mia)).
false.
我想这是某种谓词来确定参数是术语(或变量)还是复杂术语.
I guess it is some sort of predicate to determine if the argument was Terms(or Variables) or Complex Terms.
推荐答案
swi-prolog 手册有如下定义:
simple(@Term) 是semidet术语是原子的或变量.
定义在 quintus prolog 兼容库中;在 quintus prolog 文档中 定义是:
the definition is in the quintus prolog compatibility library; in the quintus prolog documentation the definition is:
简单(+术语)
Term 当前被实例化为一个原子、一个数字、一个数据库或变量.
Term is currently instantiated to either an atom, a number, a database or a variable.
无论如何,如果参数是一个简单的术语,simple/1 为真(不确定 quintus 手册中数据库的含义;我猜可能是 ODBC 连接的处理程序)
in any case, simple/1 is true if the argument is a simple term (not sure what the quintus manuals means by database; possibly a handler for an ODBC connection i guess)
这篇关于谓词“simple/1"是什么意思?在 Prolog (SWI-Prolog) 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!