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
Hi
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
Don't think so.
One thing I have often wanted is something like:
or1 a b x = a x || b x
or2 a b x y = a x y || b
Neil Mitchell wrote:
Hi
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
nearly; using Prelude:
passall ps v = all ($v) ps
passany ps v = any ($v) ps
One thing I have
On 17/01/2008, Stuart Cook [EMAIL PROTECTED] wrote:
On Jan 18, 2008 1:46 AM, Isaac Dupree [EMAIL PROTECTED] wrote:
nearly; using Prelude:
passall ps v = all ($v) ps
passany ps v = any ($v) ps
Yes, thanks Isaac. That should have been obvious, argh...
passall = swing all
passany =
On Jan 18, 2008 1:46 AM, Isaac Dupree [EMAIL PROTECTED] wrote:
Neil Mitchell wrote:
Hi
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
nearly; using Prelude:
Hello Isaac,
Thursday, January 17, 2008, 5:46:20 PM, you wrote:
yep, there's the idea of putting Bools in a typeclass that allows you to
(||) functions-returning-Bool-class-instance for example, which I
haven't used much but seems like a good idea (though potentially
confusing, especially