Hprolog library not found?

I’m using: SWI-Prolog version 8.0.2. When I try to include the hprolog library in my code, I get an error:

:- use_module(library('hprolog')).

Error text:

 source_sink `library(hprolog)' does not exist

How can I include this library in my code?

https://www.swi-prolog.org/pldoc/doc/SWI/library/dialect/hprolog.pl

I think you want :- use_module(library(dialect/hprolog)).

1 Like

Yes, but with some remarks :slight_smile: The .pl files in library/dialect are supposed to be used by e.g.,

:- expects_dialect(hprolog).

This loads this library and pushes library/dialog/hprolog as first in the library search path, allowing for SWI-Prolog libraries to be replaced by libraries that emulate the library of the selected dialect. The dialect mechanism was developed with Vitor from YAP to emulate systems.

As these libraries tend to redefine native behavior you should generally not use them as simple additional libraries. I’d typically look in the source for the comments and/or code on how to achieve the same in SWI-Prolog.

2 Likes