Skip to content

Instantly share code, notes, and snippets.

@syohex
Created July 1, 2012 14:53
Show Gist options
  • Save syohex/3028670 to your computer and use it in GitHub Desktop.
Save syohex/3028670 to your computer and use it in GitHub Desktop.
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