- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Hilog 项(即具有任意项作为仿函数的化合物)是否仍然被视为 XSB Prolog(或任何其他 Prolog)中的强大功能?
目前有很多 XSB 项目使用这个功能吗?例如,他们中的哪一个?
我问,因为据我了解,使用 ISO 内置调用/N 同样可以进行高阶编程。
具体来说,我想了解 XSB 是否只是出于历史原因使用 Hilog 术语,或者与当前的 ISO 标准相比,Hilog 术语是否具有相当大的优势。
最佳答案
在 XSB 中,Hilog 术语与 XSB 独有的模块系统密切相关。 XSB 有一个基于仿函数的模块系统。即在同一范围内length(X)
可能属于一个模块,而 length(L, N)
可能属于另一个。因此,call(length(L), N)
可能引用一个模块和 call(length(L, N))
给另一个:
[Patch date: 2013/02/20 06:17:59]
| ?- use_module(basics,length/2).
yes
| ?- length(Xs,2).
Xs = [_h201,_h203]
yes
| ?- call(length(Xs),2).
Xs = [_h217,_h219]
yes
| ?- use_module(inex,length/1).
yes
| ?- length(Xs,2).
Xs = [_h201,_h203]
yes
| ?- call(length(Xs),2).
++Error[XSB/Runtime/P]: [Existence (No module inex exists)] in arg 1 of predicate load
| ?- call(call(length,Xs),2).
Xs = [_h228,_h230];
在这种情况下,
call/N
之间可能存在差异。和 Hilog 条款。但是,到目前为止,我还没有找到一个。
call/N
已经作为 NU 中的内置程序和
library(call)
存在在 Quintus Prolog 中使用
only cursory documentation .已提议
1984 by Richard O'Keefe .另一方面,
call/N
Hilog 的作者显然不知道,如 Weidong Chen、Michael Kifer、David Scott Warren 的 p.1101 所示:HiLog: A First-Order
... Generic transitive closure can also be defined in Prolog:
closure(R, X, Y) :- C =.. [R, X, Y], call(C).
closure(R, X, Y) :- C =.. [R, X, Z], call(C), closure(R, Z, Y).However, this is obviously inelegant compared to HiLog (see Section 2.1), since this involves both constructing a term out of a list and reflecting this term into an atomic formula using "call". The point of this example is that the lack of theoretical foundations for higher-order constructs in Prolog resulted in an obscure syntax, which partially explains why Prolog programs involving such constructs are notoriously hard to understand.
call/N
来完成。像这样:
closure(R, X, Y) :- call(R, X, Y).
closure(R, X, Y) :- call(R, X, Z), closure(R, Z, Y).
这比
(=..)/2
更通用-版本因为
R
不再局限于成为一个原子。顺便说一句,我宁愿写:
closure(R_2, X0,X) :- call(R_2, X0,X1), closure0(R_2, X1,X).
closure0(_R_2, X,X).
closure0(R_2, X0,X) :- call(R_2, X0,X1), closure0(R_2, X1,X).
关于prolog - HiLog 术语在现代 Prolog 中仍然有用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15473065/
Hilog 项(即具有任意项作为仿函数的化合物)是否仍然被视为 XSB Prolog(或任何其他 Prolog)中的强大功能? 目前有很多 XSB 项目使用这个功能吗?例如,他们中的哪一个? 我问,因
这个问题在这里已经有了答案: Are HiLog terms still useful in modern Prolog? (2 个回答) 11 个月前关闭。 The Wikipedia articl
我是一名优秀的程序员,十分优秀!