flatten::Eq a => [[a]] > [a]
flatten lst = y
where
y = if (lst == []) then []
else (lst !! 0) ++ (flatten (drop 1 lst))

   
The input list lst is a list of lists of atomic tokens. For example
[[],[6],[2,7],[6],[1,6],[],[4,5]]::[[Int]]
Returns a list of atoms all of which are in lst. The order
of the atoms in the output list is the same as the order of elements in
lst. For example,
ghci> flatten [[],[6],[2,7],[6],[1,6],[],[4,5]]
[6,2,7,6,1,6,4,5]
ghci> remdups (flatten [[],[6],[2,7],[6],[1,6],[],[4,5]])
[6,2,7,1,4,5]
