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

Prev:concat-as ( seq exemplar -- newseq )
Next:join-as ( seq glue exemplar -- newseq )


Vocabulary
sequences

Inputs
seqa sequence
gluea sequence


Outputs
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