Determine if a list is a suffix of another List (second parameter). If the first parameter is a variable then suffix/2 will produce the next possible suffix of a list per call to suffix/2.
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 last/2 lengthlist/2 member/2 prefix/2 reverse/2 smallest_number/2 sublist/2 sum_list/2 sum_list_integer/2
| Example | |
| suffix([], []). | succeeds because [] is a suffix of the list [] |
| suffix([], [a]). | succeeds because [] is a suffix of the list [a] |
| suffix([b], [a, b]). | succeeds because [b] is a suffix of the list [a, b] |
| suffix([a], [a, b]). | fails because [a] is not a suffix of the list [a, b] |
| suffix(A, [a, b]). | succeeds and per call to suffix/2 another possible suffix of
[a, b] is unified with the variable A: A=[a, b] A=[b] A=[] |