Handbook
Glossary
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
len
an
integer
quot
a
quotation
with stack effect
( ... -- ... newelt )
Outputs
newseq
a
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
IN:
sequences
:
replicate
( ... len quot: ( ... -- ... newelt ) -- ... newseq )
{
}
replicate-as
;
inline