lfilter ( list quot: ( elt -- ? ) -- result )
Lazy lists ยป Combinators for manipulating lazy lists

Prev:lmap-lazy ( list quot -- result )
Next:luntil ( list quot: ( elt -- ? ) -- result )


Vocabulary
lists.lazy

Inputs
lista cons object
quota quotation with stack effect ( elt -- ? )


Outputs
resultresulting cons object


Word description
Perform a similar functionality to that of the filter word, but in a lazy manner. No evaluation of the list elements occurs initially but a lazy-filter object is returned which conforms to the list protocol. Calling car, cdr or nil? on this will evaluate elements as required.

Examples
USING: kernel lists lists.lazy math prettyprint ; 1 lfrom [ even? ] lfilter 5 ltake list>array .
{ 2 4 6 8 10 }


See also
leach, foldl, lmap-lazy, ltake, lappend-lazy, lfrom, lfrom-by, lconcat, lcartesian-product, lcartesian-product*, lcartesian-map, lcartesian-map*, lmerge, lwhile, luntil

Definition