filter-as ( ... seq quot: ( ... elt -- ... ? ) exemplar -- ... subseq )
Factor handbook > The language > Collections > Sequence operations > Sequence combinators

Prev:filter ( ... seq quot: ( ... elt -- ... ? ) -- ... subseq )
Next:partition ( ... seq quot: ( ... elt -- ... ? ) -- ... trueseq falseseq )


Vocabulary
sequences

Inputs and outputs
seqa sequence
quota quotation with stack effect ( ... elt -- ... ? )
exemplara sequence
subseqa new sequence


Word description
Applies the quotation to each element in turn, and outputs a new sequence of the same type as exemplar containing the elements of the original sequence for which the quotation output a true value.

See also
filter, filter!, reject, reject-as, reject!, sift, harvest

Definition


: filter-as
( ... seq quot: ( ... elt -- ... ? ) exemplar -- ... subseq )
pick length over [ (selector-as) [ each ] dip ] 2curry dip
like ; inline