map! ( ... seq quot: ( ... elt -- ... newelt ) -- ... seq )
Factor handbook » The language » Collections » Sequence operations » Destructive sequence operations

Next:accumulate! ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... final seq )


Vocabulary
sequences

Inputs
seqa mutable sequence
quota quotation with stack effect ( ... elt -- ... newelt )


Outputs
seqa mutable sequence


Word description
Applies the quotation to each element yielding a new element, storing the new elements back in the original sequence. Returns the original sequence.

Errors
Throws an error if the sequence is immutable, or the sequence cannot hold elements of the type output by quot.

Side effects
Modifies seq

See also
map, map-as, map-index, map-index-as

Definition


: map!
( ... seq quot: ( ... elt -- ... newelt ) -- ... seq )
over [ map-into ] keep ; inline