[Haskell-cafe] Rewriting filter with foldr

Roel van Dijk vandijk.roel at gmail.com
Sun Sep 30 09:26:31 EDT 2007

Perhaps a list comprehension better shows the intention of the filter function:

filter p xs = [x | x <- xs, p x]

You can literally read that as "take all x from xs that satisfy p".

More information about the Haskell-Cafe mailing list