Handbook
Glossary
take ( gen n -- seq )
Generators
Prev:
skip ( gen -- )
Next:
take-all ( gen -- seq )
Vocabulary
generators
Inputs
gen
a
generator
n
an
integer
Outputs
seq
a
sequence
Word description
Takes the next
n
values from the generator, collecting them into a sequence.
Definition
USING:
math
sequences
vectors
;
IN:
generators
::
take
( gen n -- seq )
n
<vector>
:>
accum
[
n
[
gen
next
accum
push
]
times
]
[
]
catch-stop-generator
accum
{
}
like
;