Find the last element in the list

?- my_last(X,[a,b,c,d]).
X = d