interleave ( ... seq between quot: ( ... elt -- ... ) -- ... )
Factor handbook > The language > Collections > Sequence operations > Sequence combinators

Prev:reduce ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... result )
Next:map ( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )


Vocabulary
sequences

Inputs and outputs
seqa sequence
betweena quotation
quota quotation with stack effect ( ... elt -- ... )


Word description
Applies quot to each element in turn, also invoking between in-between each pair of elements.

Examples
USING: io sequences ; { "a" "b" "c" } [ "X" write ] [ write ] interleave
aXbXc


Definition