Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.List (nub, sort)
- tsum' :: (Num a, Eq a) => [a] -> [a] -> [[a]]
- tsum' x y
- | lenX < 3 && lenXY >= 3 = (tsum' (x ++ [headY]) tailY) ++ (tsum' x tailY)
- | lenX == 3 && (sum x) == 0 = [x]
- | otherwise = []
- where lenX = length x
- lenXY = lenX + length y
- headY = head y
- tailY = tail y
- tsum :: (Ord a, Num a, Eq a) => [a] -> [[a]]
- tsum x = nub (tsum' [] (sort x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement