Unify the Element parameter with the last element of a List.
This predicate is located in the file 'list.txt', use ensure_loaded/1 to include this file.
see also: conc/3 del/3 largest_number/2 lengthlist/2 member/2 prefix/2 reverse/2 smallest_number/2 sublist/2 suffix/2 sum_list/2 sum_list_integer/2
| Example | |
| last(A, []). | fails because the list is empty |
| last(A, [a, b, c]). | succeeds and variable A is unified with the last element of
the list [a,b,c] A=c |
| last(b, [a, b, c]). | fails because the last element of the list is c, which cannot be unified with the first parameter, which is b |