0
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?

false
  • 10,264
  • 13
  • 101
  • 209
Android_enthusiast
  • 863
  • 5
  • 22
  • 41
  • What prolog system are you using? I'm trying it in swi-prolog 5.8.3 and nth1/3 is available by default (the lists library autoloads). – src Nov 17 '10 at 20:24
  • 1
    SICStus 3.12.1 .. isn't it built in in sicstus? – Android_enthusiast Nov 17 '10 at 20:56
  • I'm not familiar with SICStus, but looking in their web site I find that nth1/3 is present in SICStus 4 but not in SICStus 3. Can you use nth0 instead? The only difference is that it starts counting at 0 instead of 1. – src Nov 17 '10 at 21:05

1 Answers1

2

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.