DeleteAdjacentDuplicates

DeleteAdjacentDuplicates[list]

deletes all duplicates in runs of identical elements in list.

DeleteAdjacentDuplicates[list,test]

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

Details

Examples

open allclose all

Basic Examples  (3)

Delete adjacent duplicated elements:

Delete adjacent elements that coincide under Equal:

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

Scope  (2)

Delete elements unless they are larger than the preceding ones:

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

Properties & Relations  (2)

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

Delete sublists that have the same total:

The equivalent operation can be achieved using SplitBy as well:

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.

CMS

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

BibTeX

@misc{reference.wolfram_2023_deleteadjacentduplicates, author="Wolfram Research", title="{DeleteAdjacentDuplicates}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html}", note=[Accessed: 16-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_deleteadjacentduplicates, organization={Wolfram Research}, title={DeleteAdjacentDuplicates}, year={2022}, url={https://reference.wolfram.com/language/ref/DeleteAdjacentDuplicates.html}, note=[Accessed: 16-April-2024 ]}