deletes all duplicates in runs of identical elements in list.
applies test to pairs of consecutive elements to determine whether they should be considered duplicates.
- DeleteAdjacentDuplicates[list] deletes all but the first occurrence of each element that appears in a run of identical elements in list.
- DeleteAdjacentDuplicates also works on associations.
- DeleteAdjacentDuplicates never reorders elements, but only removes them.
- DeleteAdjacentDuplicates[list] is equivalent to DeleteAdjacentDuplicates[list,SameQ].
Examplesopen allclose all
Basic Examples (3)
Delete adjacent elements that coincide under Equal:
In DeleteAdjacentDuplicates[list], list may be any nonatomic expression:
Wolfram Research (2022), DeleteAdjacentDuplicates, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html.
Wolfram Language. 2022. "DeleteAdjacentDuplicates." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html.
Wolfram Language. (2022). DeleteAdjacentDuplicates. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html