DeleteAdjacentDuplicates
✖
DeleteAdjacentDuplicates
applies test to pairs of consecutive elements to determine whether they should be considered duplicates.
Details

- 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].
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Delete adjacent duplicated elements:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-23ar61

Delete adjacent elements that coincide under Equal:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-gwgu24

Delete elements whose values duplicate those just before them in the association:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-9lj38k

Scope (2)Survey of the scope of standard use cases
Delete elements unless they are larger than the preceding ones:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-uoelt8

In DeleteAdjacentDuplicates[list], list may be any nonatomic expression:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-co5up

Properties & Relations (2)Properties of the function, and connections to other functions
DeleteAdjacentDuplicates is similar to taking the first of each item from Split:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-jv1mup


https://wolfram.com/xid/0comb7n1edjgqokiumqk-dfkds3


https://wolfram.com/xid/0comb7n1edjgqokiumqk-brto0x

Delete sublists that have the same total:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-k2fvx7


https://wolfram.com/xid/0comb7n1edjgqokiumqk-neboqu

The equivalent operation can be achieved using SplitBy as well:

https://wolfram.com/xid/0comb7n1edjgqokiumqk-grxnwx

Wolfram Research (2022), DeleteAdjacentDuplicates, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html.
Text
Wolfram Research (2022), DeleteAdjacentDuplicates, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html.
Wolfram Research (2022), DeleteAdjacentDuplicates, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html.
CMS
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. Wolfram Research. https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html.
APA
Wolfram Language. (2022). DeleteAdjacentDuplicates. Wolfram Language & System Documentation Center. Retrieved from 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
BibTeX
@misc{reference.wolfram_2025_deleteadjacentduplicates, author="Wolfram Research", title="{DeleteAdjacentDuplicates}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html}", note=[Accessed: 25-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_deleteadjacentduplicates, organization={Wolfram Research}, title={DeleteAdjacentDuplicates}, year={2022}, url={https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html}, note=[Accessed: 25-March-2025
]}