zero-loop>sequence ( ... quot: ( ... n -- ... obj/f ) exemplar -- ... seq )


Vocabulary
sequences.extras

Inputs
quota quotation
exemplaran object


Outputs
seqa sequence


Word description
Call the quot, which takes an integer starting from zero and incrementing on every loop, and should output an object or f, and collect the objects in array until quot outputs f.

Examples
Example:
USING: sequences.extras prettyprint math.text.english math kernel ; [ dup 5 < [ number>text ] [ drop f ] if ] V{ } zero-loop>sequence .
V{ "zero" "one" "two" "three" "four" }


See also
loop>array, loop>array*, loop>array**, loop>sequence, loop>sequence*, loop>sequence**, zero-loop>array

Definition


: zero-loop>sequence
( ... quot: ( ... n -- ... obj/f ) exemplar -- ... seq )
[ 0 ] [ [ keep 1 + swap ] curry ] [ loop>sequence ] tri* nip
; inline