WOLFRAM

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.

Details

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Delete adjacent duplicated elements:

Out[1]=1

Delete adjacent elements that coincide under Equal:

Out[1]=1

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

Out[1]=1

Scope  (2)Survey of the scope of standard use cases

Delete elements unless they are larger than the preceding ones:

Out[1]=1

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

Out[1]=1

Properties & Relations  (2)Properties of the function, and connections to other functions

DeleteAdjacentDuplicates is similar to taking the first of each item from Split:

Out[1]=1
Out[2]=2
Out[3]=3

Delete sublists that have the same total:

Out[1]=1
Out[2]=2

The equivalent operation can be achieved using SplitBy as well:

Out[3]=3
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.

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 ]}

@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 ]}

@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 ]}