Guest User

Untitled

a guest
Dec 10th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. partition1 :: (Int -> Bool) -> [Int] -> ([Int],[Int])
  2. partition1 f a xs = partition f ([],xs) xs
  3.  
  4. partition :: (Int -> Bool) -> ([Int],[Int]) -> [Int] -> ([Int],[Int])
  5. partition _  xs [] = xs
  6. partition f (t,r) (x:xs)
  7.     | f x = (init t,last t:r)
  8.     | otherwise = partition f (t ++ [x], tail r) xs
Add Comment
Please, Sign In to add comment