Flatten a list: Difference between revisions

Content deleted Content added
Line 48: Line 48:
-- implemented as multiway tree:
-- implemented as multiway tree:


-- since Data.Tree represents trees where nodes have values too,
-- Data.Tree represents trees where nodes have values too, unlike the trees in our problem.
-- we use a list as that value, where a node will have an empty list value,
-- so we use a list as that value, where a node will have an empty list value,
-- and a leaf will have a one-element list value and no subtrees
-- and a leaf will have a one-element list value and no subtrees
list :: Tree [Int]
list :: Tree [Int]