manews
manews

Reputation: 410

What's the module name of built-in predicate 'term_string/3' in SWI-Prolog 7.1.3?

I am using a framework that has globally overridden the built-in predicate term_string/3 with different behaviour. Now i would like to use the built-in one, but what is its module name? I would like to call <ItsModuleName>:term_string(..)

I know that list operations have a separate module :- use_module(library(lists)) that can be referred to explicitly by lists:append(..) for example. I have searched through the documentation on the web and in the SWI manual but couldn't find anything.

Upvotes: 1

Views: 176

Answers (1)

Paulo Moura
Paulo Moura

Reputation: 18663

You can query the properties of a predicate using the standard predicate_property/2 predicate. In this case we get:

?- 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.

The property you want is imported_from(Module), which ins this case tells you that the predicate temr_String/3 is exported from module '$syspreds'. But given that this modules defines system built-in predicates, you should be able to use as alternative system:term_string(...) as the documentation states that "Module user imports from system where all built-in predicates reside.".

Upvotes: 1

Related Questions