Search code examples
prologsicstus-prolog

prolog Existance error: procedure does not exist


Existence error in user:nth1/3
! procedure user:nth1/3 does not exist

I have included module for lists : :- use_module(library(lists)). but still getting this error..

Can anyone please help?


Solution

  • With SICStus 3, try using nth/3 instead of nth1/3 -- the latter doesn't exist in the lists library.

    If your code actually calls user:nth1( , , ), then nth1/3 (or whatever else you've prefixed with user:) needs to be defined in the user module for user-defined code, which it seems is not the case in your environment given the error you've described. If this is the case, try again without the user: module prefix. If the predicate is a system predicate and is definitely loaded, the PROLOG system should find it automatically. If it can't, PROLOG will then assume it's something you should have defined in the user module, hence why it may be looking there.