push ( elt seq -- )
Factor documentation > Factor handbook > The language > Collections > Sequence operations > Treating sequences as stacks
Next:push-all ( src dst -- )


Vocabulary
sequences

Inputs and outputs
eltan object
seqa resizable mutable sequence


Word description
Adds an element at the end of the sequence. The sequence length is adjusted accordingly.

Errors
Throws an error if seq is not resizable, or if the type of elt is not permitted in seq.

Side effects
Modifies seq

See also
prefix, suffix

Definition
USING: kernel ;

IN: sequences

: push ( elt seq -- ) [ length ] [ set-nth ] bi ;