add

Adds an element to a sequence.

Returns a sequence that contains new-element and all the elements of source-sequence.  The result-sequence may or may not be freshly allocated.  It may share structure with a preexisting sequence.

source-sequence is not modified by this operation.

The result-sequence’s size is one greater than the size of source-sequence.  The generic function add doesn’t specify where the new element will be added, although individual methods may do so.

define variable *numbers* = #(3, 4, 5)
add (*numbers*, 1)
⇒ #(1, 3, 4, 5)
*numbers*
⇒ #(3, 4, 5)

Exported from

Modifiers

open

Arguments

source-sequenceAn instance of <sequence>.
new-elementAn instance of <object>.

Values

result-sequenceAn instance of <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.