listlib::removeDupSorted
-- remove duplicates of any element from ordered lists
Introductionlistlib::removeDupSorted(list) removes all
duplicates of any element of the ordered list list.
Call(s)listlib::removeDupSorted(list)
Parameterslist |
- | an ordered MuPAD list |
Returnsa list that contains every element only once
Related
Functions
Detailslistlib::removeDupSorted removes all duplicates of
every element of an ordered list.listlib::removeDupSorted does the same as listlib::removeDuplicates,
but it assumes that the list is sorted and therefor it is faster. A
notable gain will only occur, if there are only few duplicates in a
long list.
Example
1listlib::removeDupSorted removes all
duplicates from the given list:
>> listlib::removeDupSorted([1, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7])
[1, 3, 5, 7]
If the list is not ordered,
listlib::removeDupSorted fails:
>> listlib::removeDupSorted([1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7])
[1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7]
listtools::removeDupSorted