The LAST element of a list - back to content

		Examples:
		?- last([a],R)
		R=a
	  	?-last([a,b,1,c],X).
	 	X=c
	  	?-last([a,b,[c,[d]]],X).
	  	X=[c,[d]]

Solution 1. last([X],X). last([H|T],R):- last(T,R).
Solution 2. last(L,R):- append(_,[R],L). append/2 is a Prolog predicate: append([],Y,Y). append([H|T],Y,[H|R]):- append (T,Y,R).