Keep exactly the elements of a list satisfying a predicate, preserving their relative order. A recursive step tests the head, prepending it to the filtered tail when it passes and otherwise returning that filtered tail alone. On a finite input, this uses one predicate evaluation per element; an infinite rejected tail cannot produce a next output under lazy evaluation.
Articles by others on the same topic
There are currently no matching articles.