11.2 Built-in Native Predicates

Some of the built-in predicates provided by SWI-Prolog, such as is/2, are implemented in C and included as native functions in the SWI-Prolog runtime. It is sometimes useful to examine the implementation of such native built-in predicates by reading its definition in the SWI-Prolog C sources. Sweep knows about SWI-Prolog native built-ins, and can find and jump to their definitions in C when the user has the SWI-Prolog sources checked out locally.

User Option: sweeprolog-swipl-sources

Location of the SWI-Prolog source code root directory.

The way Sweep locates the SWI-Prolog sources depends on the user option sweeprolog-swipl-sources. Setting it to nil disables searching for definitions of native built-ins altogether. To point Sweep to the root directory of the SWI-Prolog source code, set sweeprolog-swipl-sources to the name of that directory. Any non-nil non-string value says to try and locate a checkout of the SWI-Prolog sources among known project root directories (Sweep consults Emacs’s built-in project-known-project-roots to find your project roots, see (emacs)Projects).

With sweeprolog-swipl-sources set, the provided commands for finding predicate definitions operate seamlessly on native built-ins to display their C definitions. These commands include: