add-new

Adds a new element to a sequence.

Adds new-element to source-sequence if it is not already an element of source-sequence, as determined by the test function.  If new-element is already a member of source-sequence, then source-sequence is returned unmodified.

If an element is added, add-new operates just as add would.

The test function may be non-commutative: it is always called with an element from source-sequence as its first argument and new-element as its second argument.

add-new (#(3, 4, 5), 1)
⇒ #(1, 3, 4, 5)
add-new (#(3, 4, 5), 4)
⇒ #(3, 4, 5)

Exported from

Modifiers

open

Arguments

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

Values

result-sequenceAn instance of <sequence>.
Adds a new element to a sequence.
Adds an element to a 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 all Dylan objects.
The class of objects that can be applied to arguments.
Compares two objects for identity.