Selects from a list n elements (from beginning/end) - back to content

		The last element of a list 
		?- last([1,2,3,4],R).
		R = 4

		last(L,R):- append(X,[R],L).

The last 2 elements of a list ?- last2([1,2,3,4],R). R = [3,4] last2(L,[A,B]):- append(X,[A,B],L).
The last n elements of a list L. ?-lastn([1,2,3,4],2,T). T = [3,4] lastn(L,N,Y):- append(X,Y,L),length(Y,N).
The first n elements of a list. ?- firstn([1,2,3,4,5],3,W). W = [1,2,3] firstn(L,N,X):- append(X,Y,L),length(X,N).