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

Prev:accumulate*-as ( ... seq identity quot: ( ... prev elt -- ... next ) exemplar -- ... newseq )
Next:filter-as ( ... seq quot: ( ... elt -- ... ? ) exemplar -- ... subseq )


Vocabulary
sequences

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


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

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

Definition


: filter
( ... seq quot: ( ... elt -- ... ? ) -- ... subseq )
over filter-as ; inline