Provides access to the clauses of a predicate using their index number.
Counting starts at 1. If Reference is specified it unifies Pred
with the most general term with the same name/arity as the predicate and
Index with the index number of the clause. Otherwise the name
and arity of Pred are used to determine the predicate. If Index
is provided, Reference will be unified with the clause
reference. If Index is unbound, backtracking will yield both
the indexes and the references of all clauses of the predicate. The
following example finds the 2nd clause of append/3:
?- use_module(library(lists)).
...
?- nth_clause(append(_,_,_), 2, Ref), clause(Head, Body, Ref).
Ref = <clause>(0x994290),
Head = lists:append([_G23|_G24], _G21, [_G23|_G27]),
Body = append(_G24, _G21, _G27).