SWI-Prolog 7.1.3 中内置谓词 'term_string/3' 的模块名称是什么?
What's the module name of built-in predicate 'term_string/3' in SWI-Prolog 7.1.3?
我正在使用一个框架,该框架以不同的行为全局覆盖了内置谓词 term_string/3
。
现在我想使用内置的,但它的模块名称是什么?
我想打电话给<ItsModuleName>:term_string(..)
我知道列表操作有一个单独的模块 :- use_module(library(lists))
可以明确引用
lists:append(..)
例如。
我在网上和 SWI 手册中搜索了文档,但找不到任何内容。
您可以使用标准 predicate_property/2
谓词查询谓词的属性。在这种情况下,我们得到:
?- predicate_property(term_string(_,_,_), P).
P = interpreted ;
P = visible ;
P = built_in ;
P = static ;
P = imported_from('$syspreds') ;
P = file('/Users/pmoura/lib/swipl-7.3.1/boot/syspred.pl') ;
P = line_count(1196) ;
P = nodebug ;
P = number_of_clauses(2) ;
P = number_of_rules(2) ;
false.
你想要的 属性 是 imported_from(Module)
,在这种情况下告诉你谓词 temr_String/3
是从模块 '$syspreds'
导出的。但是鉴于此模块定义了系统内置谓词,您应该能够使用 system:term_string(...)
作为替代方法,因为文档指出 "Module user
imports from system
where all built-in predicates reside.".
我正在使用一个框架,该框架以不同的行为全局覆盖了内置谓词 term_string/3
。
现在我想使用内置的,但它的模块名称是什么?
我想打电话给<ItsModuleName>:term_string(..)
我知道列表操作有一个单独的模块 :- use_module(library(lists))
可以明确引用
lists:append(..)
例如。
我在网上和 SWI 手册中搜索了文档,但找不到任何内容。
您可以使用标准 predicate_property/2
谓词查询谓词的属性。在这种情况下,我们得到:
?- predicate_property(term_string(_,_,_), P).
P = interpreted ;
P = visible ;
P = built_in ;
P = static ;
P = imported_from('$syspreds') ;
P = file('/Users/pmoura/lib/swipl-7.3.1/boot/syspred.pl') ;
P = line_count(1196) ;
P = nodebug ;
P = number_of_clauses(2) ;
P = number_of_rules(2) ;
false.
你想要的 属性 是 imported_from(Module)
,在这种情况下告诉你谓词 temr_String/3
是从模块 '$syspreds'
导出的。但是鉴于此模块定义了系统内置谓词,您应该能够使用 system:term_string(...)
作为替代方法,因为文档指出 "Module user
imports from system
where all built-in predicates reside.".