:- module(nth,[nth/3]).

nth(Index,List,Element) :-
	var(Index),
	nth0(I,List,Element),
	Index is I+1.
nth(Index,List,Element) :-
	nonvar(Index),
	I is Index-1,
	nth0(I,List,Element).

