I'm learning Prolog as part of CS2104. Consider a predicate in Prolog that checks if the Nth-indexed element of a list is Y:
nth([],_,_) :- fail. nth([X|_],0,X). nth([_|T],N,Y) :- N #> 0, N1 #= N-1, nth(T,N1,Y).
This is fine ...
Read more | Comments