Tree traversal: Difference between revisions
m
→Data.Tree nodes: Small reduction of levels function
m (→Data.Tree nodes: Small reduction of levels function) |
|||
Line 4,989:
[] -> ([], [])
(y : ys) -> (y, ys)
in
nodeCount,
Line 5,012:
treeWidth _ [] = 1
treeWidth _ xs = sum xs
treeLeaves :: Tree a -> [a]
treeLeaves = go
where
go (Node x []) = [x]
go (Node _ xs) = xs >>= go
Line 5,041 ⟶ 5,040:
print $ levelOrder tree
putStrLn ""
(putStrLn . unlines)
( ( \(k, f) ->
Line 5,057 ⟶ 5,056:
]
)
justifyLeft, justifyRight :: Int -> Char -> String -> String
|