Source: PROLOG str. 50 Wydawnictwo PLJ Warszawa 1991 ISBN 83-85190-63-5
Program source code: last_element.pl
ostatni(X, [X]). ostatni(X, [_|X]) :- ostatni(X, Y). test :- ostatni(X, [4, 3, 5, 6, 7]).