Checking if a predicate is "built in"

Hi!

I expected ?- predicate_property(member(A, B), built_in). to yield true but i get false. I want to find a way to check if a predicate is a predicate that comes with the SWI Prolog installation because i want to call/1 it in a meta-interpreter.

Is there a way to distinguish between, say, !, subtract(A, B, C), and member(A, B), on the one hand, and, say grandfather(A, B), banana(A), and myPredicate(A) on the other hand? I can’t use the property defined because this also yields true for predicates which are asserted by the user. Should i use the property imported_from(_)?

I am using SWI Prolog 8.2.1 on mac os Catalina.

Cheers/JCR

1 Like

Nice question. Would like to know the answer myself.

I am thinking that perhaps you need to come at this differently and include module_property/2 into the query that checks if the predicate will work with call/1. In the end I think you will need to select the predicates based on the class value from module_property/2 and store the values for allowed class as a fact or in the predicate that checks if a predicate meets your criteria.

HTH

Thanks Eric, that seems to be the best way to go.

/JCR

1 Like