Guest User

Untitled

a guest
Aug 8th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. nousevat :: [Int] -> [[Int]]
  2. nousevat [] = [[]]
  3. nousevat (x:xs) = sorted:nousevat rest
  4.   where helper = nousevat' xs [x]
  5.        sorted = fst helper
  6.        rest = snd helper
  7.  
  8. nousevat' :: [Int] -> [Int] -> ([Int], [Int])
  9. nousevat' [] res = (res, [])
  10. nousevat' (x:xs) res = if x > (res !! 0) then nousevat' xs (x:res) else (res, (x:xs))
Add Comment
Please, Sign In to add comment