listlib::sublist
-- search
sublistslistlib::sublist(
list1, list2)
determines,
whether the list list1
contains another list
list2
.
listlib::sublist(list1, list2 <, index> <,
option>)
list1, list2 |
- | MuPAD list |
index |
- | integer, that determines the first search position |
option |
- | option Consecutive |
Consecutive |
- | determines that the sublist list2 is
containing coherent in list1 |
the position of the first element of the containing sublist or zero
listlib::sublist
the position of the first
appearance of a list in another list can be determined.sublist
, the number
0
is returned.The sublist is a part of the list, but not in one piece:
>> listlib::sublist([1, 2, 3, 4, 5, 6, 7, 8], [2, 3, 5, 6])
2
>> listlib::sublist([1, 2, 3, 4, 5, 6, 7, 8], [2, 3, 5, 6], Consecutive)
0
The list contains the sublist, coherent and incoherent:
>> listlib::sublist([1, 2, 3, 4, 5, 1, 3, 5], [1, 3, 5])
1
>> listlib::sublist([1, 2, 3, 4, 5, 1, 3, 5], [1, 3, 5], Consecutive)
6
Find the last occurence of the sublist inside of the list:
>> POS:= 0: while listlib::sublist([1, 2, 3, 1, 3, 1, 2, 3], [1, 2, 3], POS + 1) > 0 do POS:= listlib::sublist([1, 2, 3, 1, 3, 1, 2, 3], [1, 2, 3], POS + 1) end_while: POS
6
>> delete POS:
listtools::sublist