Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Prelude> :t p xs -> (filter p xs, filter (not . p) xs)
- p xs -> (filter p xs, filter (not . p) xs)
- :: (a -> Bool) -> [a] -> ([a], [a])
- Prelude> :hoogle (a -> Bool) -> [a] -> ([a], [a])
- Prelude break :: (a -> Bool) -> [a] -> ([a], [a])
- Prelude span :: (a -> Bool) -> [a] -> ([a], [a])
- Data.List break :: (a -> Bool) -> [a] -> ([a], [a])
- Data.List partition :: (a -> Bool) -> [a] -> ([a], [a])
- Data.List span :: (a -> Bool) -> [a] -> ([a], [a])
- Prelude> break odd [1..10]
- ([],[1,2,3,4,5,6,7,8,9,10])
- Prelude> span odd [1..10]
- ([1],[2,3,4,5,6,7,8,9,10])
- Prelude> import Data.List
- Prelude Data.List> partition odd [1..10]
- ([1,3,5,7,9],[2,4,6,8,10])
- partition (>2) [1,2,3,4,5]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement