Im learning prolog and was having problems with the select/3
predicate so I made a test file for it.
The entire code i'm trying to run is the following 1 line of XSB in its own file:
find(X,B) :- select(X, [1,2,3,4,5], B).
It compiles fine but I'm getting the following error:
| ?- find(5,B).
++Error[XSB/Runtime/P]: [Existence (No procedure usermod : select / 3 exists)] []
Forward Continuation...
... machine:xsb_backtrace/1 From c:/program files (x86)/XSB/syslib/machine.xwam
... x_interp:_$call/1 From c:/program files (x86)/XSB/syslib/x_interp.xwam
... x_interp:call_query/1 From c:/program files (x86)/XSB/syslib/x_interp.xwam
... standard:call/1 From c:/program files (x86)/XSB/syslib/standard.xwam
... standard:catch/3 From c:/program files (x86)/XSB/syslib/standard.xwam
... x_interp:interpreter/0 From c:/program files (x86)/XSB/syslib/x_interp.xwam
... loader:ll_code_call/3 From c:/program files (x86)/XSB/syslib/loader.xwam
... loader:load_object_file/2 From c:/program files (x86)/XSB/syslib/loader.xwam
... standard:call/1 From c:/program files (x86)/XSB/syslib/standard.xwam
... standard:catch/3 From c:/program files (x86)/XSB/syslib/standard.xwam
AFAIK this error is usually when theres a prblem with a user defined predicate but this is a standard function and the documentation says it auto-imports so why am I getting this error?
The
select/3
predicate is a common library predicate. It seems that, despite using XSB, you're reading another Prolog system documentation. Likely, SWI-Prolog, which provides an auto-loading mechanism, which doesn't exist in XSB. But you can manually import the predicate. For example:To add the import to your source file, write it as a directive at the beginning of the file: