lengthen ( n seq -- )
Factor handbook > The language > Collections > Sequence operations > Sequence protocol

Prev:set-length ( n seq -- )
Next:like ( seq exemplar -- newseq )


Inputs and outputs
na non-negative integer
seqa resizable sequence

Generic word contract
Ensures the sequence has a length of at least n elements. This word differs from set-length in two respects:
This word does not shrink the sequence if n is less than its length.
The word doubles the underlying storage of seq, whereas set-length is permitted to set it to equal n. This ensures that repeated calls to this word with constant increments of n do not result in a quadratic amount of copying, so that for example push-all can run efficiently when used in a loop.