change produce-as so it uses an intermediate vector of a type appropriate to the destination type
parent
6e22945d41
commit
fdea9b09f2
|
@ -498,11 +498,14 @@ PRIVATE>
|
||||||
: partition ( seq quot -- trueseq falseseq )
|
: partition ( seq quot -- trueseq falseseq )
|
||||||
over [ 2pusher [ each ] 2dip ] dip [ like ] curry bi@ ; inline
|
over [ 2pusher [ each ] 2dip ] dip [ like ] curry bi@ ; inline
|
||||||
|
|
||||||
|
: accumulator-for ( quot exemplar -- quot' vec )
|
||||||
|
[ length ] keep new-resizable [ [ push ] curry compose ] keep ; inline
|
||||||
|
|
||||||
: accumulator ( quot -- quot' vec )
|
: accumulator ( quot -- quot' vec )
|
||||||
V{ } clone [ [ push ] curry compose ] keep ; inline
|
V{ } accumulator-for ; inline
|
||||||
|
|
||||||
: produce-as ( pred quot exemplar -- seq )
|
: produce-as ( pred quot exemplar -- seq )
|
||||||
[ accumulator [ while ] dip ] dip like ; inline
|
dup '[ _ accumulator-for [ while ] dip ] dip like ; inline
|
||||||
|
|
||||||
: produce ( pred quot -- seq )
|
: produce ( pred quot -- seq )
|
||||||
{ } produce-as ; inline
|
{ } produce-as ; inline
|
||||||
|
|
Loading…
Reference in New Issue