name = 'last_elem/2' slug = 'find last element in list' description = '''\
last_elem(L, E): E is the last element of list L.
last_elem(L, E)
E
L
?- last_elem([1,2,3], X). X = 3. ?- last_elem([3,2,X], 1). X = 1.