Created
July 1, 2012 14:53
-
-
Save syohex/3028670 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
all' :: (a -> Bool) -> [a] -> Bool | |
all' _ [] = True | |
all' f (x:xs) = if f x then all' f xs else False | |
any' :: (a -> Bool) -> [a] -> Bool | |
any' _ [] = False | |
any' f (x:xs) = if f x then True else any' f xs | |
takeWhile' :: (a -> Bool) -> [a] -> [a] | |
takeWhile' _ [] = [] | |
takeWhile' f (x:xs) = if f x then x : (takeWhile' f xs) else xs | |
dropWhile' :: (a -> Bool) -> [a] -> [a] | |
dropWhile' _ [] = [] | |
dropWhile' f (x:xs) = if f x then (dropWhile' f xs) else x : xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment