且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Swi-Prolog中的冒号(:)代表什么?

更新时间:2022-06-27 01:05:41

这是 module 限定符,您可以通过以下方式查看其声明:

That's the module qualifier, you can see its declaration with this:

?- current_op(X,Y,:).
X = 600,
Y = xfy.

模块是Prolog的重要扩展,大型程序特别需要此模块,但未符合ISO标准. SWI-Prolog(通常)对此具有务实的观点,并实现了一种有用的方法.

Modules are an important extension to Prolog, particularly required for large programs, but miss from ISO standard. SWI-Prolog has (as usually) a pragmatic viewpoint on this, and implements an useful approach.

OT 检查操作员,您会发现此片段很有用:

OT inspecting operators, you could find this snippet useful:

oplist :-
    setof((A,C,B), current_op(A,B,C), L),
    maplist(writeln, L).