Last active
March 26, 2017 08:20
-
-
Save satendrakumar/53c66536ce9a25d883886e1102b789d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prelude> let forall :: (a -> Bool) -> [a] -> Bool ; forall f []= True; forall f (x:xs) = f x && forall f xs | |
Prelude> forall even [2,4,6] | |
True | |
Prelude> forall even [2,4,5] | |
False | |
Prelude> let forall :: (a -> Bool) -> [a] -> Bool ; forall f []= True; forall f (x:xs) = if (f x) then forall f xs else False | |
Prelude> forall even [2,4,5] | |
False | |
Prelude> forall even [2,4,6] | |
True | |
Prelude> let forall :: (a -> Bool) -> [a] -> Bool ;forall f xs = and[f x| x<-xs ] // easy but not effective. | |
Prelude> forall even [2,4,5] | |
False | |
Prelude> forall even [2,4,6] | |
True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment