General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Another termination criterium

The recursive list processing predicates that we have seen so far either terminate when the empty list is found or when an element with a particular property has been found. This exercise involves a different termination criterium.

Define a predicate get_nth_element(+N,+List,?R) which is true if R is the N-th element of the list List.

Hint

Back to the practical session of day 3.