push-if ( ..a elt quot: ( ..a elt -- ..b ? ) accum -- ..b )


Vocabulary
sequences

Inputs and outputs
eltan object
quota quotation with stack effect ( ..a elt -- ..b ? )
accuma resizable mutable sequence


Word description
Adds the element at the end of the sequence if the quotation yields a true value.

Notes
This word is a factor of filter.

Definition
USING: kernel ;

IN: sequences

: push-if
( ..a elt quot: ( ..a elt -- ..b ? ) accum -- ..b )
[ keep ] dip rot [ push ] [ 2drop ] if ; inline