map ( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )
Factor documentation > Factor handbook > The language > Collections > Sequence operations > Sequence combinators
Prev:replicate-as ( ... len quot: ( ... -- ... newelt ) exemplar -- ... newseq )
Next:map-as ( ... seq quot: ( ... elt -- ... newelt ) exemplar -- ... newseq )


Vocabulary
sequences

Inputs and outputs
seqa sequence
quota quotation with stack effect ( ... elt -- ... newelt )
newseqa new sequence


Word description
Applies the quotation to each element of the sequence in order. The new elements are collected into a sequence of the same class as the input sequence.

Definition
USING: kernel ;

IN: sequences

: map
( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )
over map-as ; inline