add!

Adds an element to a sequence, possibly modifying the 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 and result-sequence may or may not be ==.

source-sequence may be modified by this operation.

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* = list (3, 4, 5)
add! (*numbers*, 1)
⇒ #(1, 3, 4, 5)
*numbers*
⇒ {undefined}

Exported from

Modifiers

open

Arguments

source-sequenceAn instance of type-union(<set>, <sequence>).
new-elementAn instance of <object>.

Values

result-sequenceAn instance of type-union(<set>, <sequence>).
Summary
Adds an element to a sequence, possibly modifying the sequence.
The result of add! on a <list> is equivalent to pair(element, list).

Functions

add!

The result of add! on a <list> is equivalent to pair(element, list).  The result will share structure with the list argument, but it will not be == to the argument, and the argument will not be modified.

Adds an element to a sequence, possibly modifying the sequence.
The class of linked lists.
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 all Dylan objects.