How can a foreign language predicate also be a built-in predicate?

Binding an attributed variable schedules a goal to be executed at the first possible opportunity. In the current implementation the hooks are executed immediately after a successful unification of the clause-head or successful completion of a foreign language (built-in) predicate.

Do you know what this phrase “foreign language (built-in) predicate” means? I normally associate the term “foreign language” with an external module written in another programming language like “C/C++” and “built-in” as a part of the host language, which in this case is Prolog. How can a foreign language predicate also be a built-in predicate?

The low level parts of SWI-Prolog are written C and are thus foreign language. Many of the built-in predicates, e.g. unification (=), are low level and implemented in C and is thus a foreign language (built-in) predicate.

See: Unification

There are many such predicates. In this directory look for the files named pl-<name>.c

The keyword when searching the C code for such predicates is PRED_IMPL

2 Likes