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


Vocabulary
sequences

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


Outputs
None

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.

See also
push, push-either, pop, pop*, prefix, suffix, suffix!

Definition


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