Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- partition1 :: (Int -> Bool) -> [Int] -> ([Int],[Int])
- partition1 f a xs = partition f ([],xs) xs
- partition :: (Int -> Bool) -> ([Int],[Int]) -> [Int] -> ([Int],[Int])
- partition _ xs [] = xs
- partition f (t,r) (x:xs)
- | f x = (init t,last t:r)
- | otherwise = partition f (t ++ [x], tail r) xs
Add Comment
Please, Sign In to add comment