replicate ( ... len quot: ( ... -- ... newelt ) -- ... newseq )
Factor handbook » The language » Collections » Sequence operations » Sequence combinators

Prev:longest ( seqs -- elt )
Next:replicate-as ( ... len quot: ( ... -- ... newelt ) exemplar -- ... newseq )


Vocabulary
sequences

Inputs
lenan integer
quota quotation with stack effect ( ... -- ... newelt )


Outputs
newseqa sequence


Word description
Calls the quotation len times, collecting results into a new array.

Examples
USING: kernel prettyprint random sequences ; 5 [ 100 random ] replicate .
{ 52 10 45 81 30 }


See also
replicate-as

Definition

: replicate
( ... len quot: ( ... -- ... newelt ) -- ... newseq )
{ } replicate-as ; inline