Reputation: 1425
I've been dealing with lists in SICStus Prolog 4.3.0 (latest version) and I have the need to print an element of a list which Index is N.
I made some research and the predicate nth
seemed to be the one:
nth0(?N, ?List, ?Elem)
I gave it a go and tried it out but apparently the predicate is not recognized anywhere:
| ?- nth0(3, [a, b, c, d, e], Elem).
! Existence error in user:nth0/3
! procedure user:nth0/3 does not exist
! goal: user:nth0(3,[a,b,c,d,e],_217)
Any suggestions on what is going on?
Edit: I looked up the documentation for SICStus 4.3.0 and the predicate does exist. It just won't be recognized.
Edit2: I tried adding the lists library : :- use_module(library(lists)).
Still nothing.
Upvotes: 0
Views: 824