join ( seq glue -- newseq )
Factor handbook > The language > Collections > Sequence operations > Appending sequences

Prev:concat ( seq -- newseq )
Next:pad-head ( seq n elt -- padded )


Vocabulary
sequences

Inputs and outputs
seqa sequence
gluea sequence
newseqa sequence


Word description
Concatenates a sequence of sequences together into one sequence, placing a copy of glue between each pair of sequences. The resulting sequence is of the same class as glue.

Examples
Join a list of strings:
USING: sequences prettyprint ; { "cat" "dog" "ant" } " " join .
"cat dog ant"


Notes
If the glue sequence is empty, this word calls concat-as.

Errors
Throws an error if one of the sequences in seq contains elements not permitted in sequences of the same class as glue.

See also
join-as, concat, concat-as

Definition