remove-duplicates!

Returns a sequence without duplicates, possibly modifying the sequence.

test is the function used to determine whether one element is a duplicate of another.  The test argument may be non-commutative; it will always be called with its arguments in the same order as they appear in source-sequence.

The result-sequence may or may not be freshly allocated, may or may not share structure with the source-sequence, and may or may not be == to the source-sequence.  The source-sequence may or may not be modified by the operation.

define variable *menu* = #("spam", "eggs", "spam",
"sausage", "spam", "spam")
remove-duplicates! (*menu*, test: \=)
⇒ #("spam", "eggs", "sausage")
or
⇒ #("eggs", "spam", "sausage")
or
⇒ #("eggs", "sausage", "spam")
*menu*
⇒ {undefined}

Exported from

Modifiers

open

Arguments

source-sequenceAn instance of <sequence>.
test:An instance of <function>.  The default is ==.

Values

result-sequenceAn instance of <sequence>.
The common-dylan module.
Whenever possible, we have tried to keep the Dylan module pristine and unextended, preferring to add our extensions to separate modules or libraries.
The class of collections whose keys are consecutive integers starting from zero.
The class of objects that can be applied to arguments.
Compares two objects for identity.