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