dlist-filter ( ... dlist quot: ( ... value -- ... ? ) -- ... dlist' )
Factor handbook » The language » Collections » Double-linked lists

Prev:dlist-find ( ... dlist quot: ( ... value -- ... ? ) -- ... obj/f ? )
Next:dlist-any? ( ... dlist quot: ( ... value -- ... ? ) -- ... ? )


Vocabulary
dlists

Inputs
dlista dlist
quota quotation


Outputs
dlist'a dlist


Word description
Applies the quotation to each element of the dlist in turn, removing the corresponding nodes if the quotation returns f.

Side effects
Modifies dlist

Definition


: dlist-filter
( ... dlist quot: ( ... value -- ... ? ) -- ... dlist' )
<dlist>
[ [ push-back ] curry [ [ drop ] 1if ] 2curry dlist-each ]
keep ; inline