Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
replicate ( ... len quot: ( ... -- ... newelt ) -- ... newseq )
Factor documentation
>
Factor handbook
>
The language
>
Collections
>
Sequence operations
>
Sequence combinators
Prev:
interleave ( ... seq between quot: ( ... elt -- ... ) -- ... )
Next:
replicate-as ( ... len quot: ( ... -- ... newelt ) exemplar -- ... newseq )
Vocabulary
sequences
Inputs and outputs
len
an
integer
quot
a
quotation
with stack effect
( ... -- ... newelt )
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