
17 Jan
2008
17 Jan
'08
9:22 a.m.
Are the functions
passall, passany :: [a -> Bool] -> a -> Bool passall ps v = and $ map ($v) ps passany ps v = or $ map ($v) ps
or something similar defined anywhere? Such that one can write
filter (passany tests) [0..10] filter (passall tests) [0..10]
where
tests = [>5, odd]
Or is there a better way of filtering by several predicates for each value without using
filter p3 . filter p2 . filter p1
or
filter (\v -> p1 v && p2 v && p3 v) vs
Cheers, D -- Dougal Stanton dougal@dougalstanton.net // http://www.dougalstanton.net