loop>sequence* ( ... quot: ( ... -- ... obj ? ) exemplar -- ... seq )


Vocabulary
sequences.extras

Inputs
quota quotation
exemplaran object


Outputs
seqa sequence


Word description
Call quot, which should output an object and a bool, and collect the objects in seq of type exemplar until quot outputs f. Do collect the last object.

Examples
USING: sequences.extras prettyprint io.encodings.binary random random.mersenne-twister kernel math ; ! Get random numbers until one of them is greater than 5 ! but also output the last number 123 <mersenne-twister> [ [ 10 random dup 5 > ] V{ } loop>sequence* ] with-random .
V{ 6 7 2 }


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

Definition


: loop>sequence*
( ... quot: ( ... -- ... obj ? ) exemplar -- ... seq )
[ t ] [ [ dip ] curry [ [ f f f ] if* ] curry [ swap ] ]
[ produce-as 2nip ] tri* ; inline