1 2 3 4 5 6 7 8 9 10 11 12
data Tree a = Node a (Tree a) (Tree a) | Tip flatten :: Tree a -> [a] flatten x = (flatten' x)  flatten' :: Tree a -> [a] -> [a] flatten' (Node x left right) l = (flatten' left (x:(flatten' right l))) flatten' Tip l = l main = putStrLn $ show $ flatten $ (Node 2 (Node 1 Tip Tip) (Node 4 (Node 3 Tip Tip) Tip))
You have reached a limit of free submissions this month.
You cannot send submissions this month anymore because of exceeding your monthly limit. Please recharge your account.
the submission is still running...
- upload with new input
result: Success time: 0.02s memory: 3592 kB returned value: 0