RosettaCodeData/Task/Flatten-a-list/Ela/flatten-a-list-1.ela
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

9 lines
227 B
Text

xs = [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []]
flat = flat' []
where flat' n [] = n
flat' n (x::xs)
| x is List = flat' (flat' n xs) x
| else = x :: flat' n xs
flat xs