Visualize a tree: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: Added a version using Data.Tree `drawTree`)
Line 978: Line 978:


The '''Data.Tree''' module in the standard (GHC) libraries also includes a '''drawTree''' function for multiway (rose) trees of strings.
The '''Data.Tree''' module in the standard (GHC) libraries also includes a '''drawTree''' function for multiway (rose) trees of strings.
We can fmap show over our tree of integers to derive a tree of strings, and apply `drawTree` to that.
We can ''fmap show'' over our tree of integers to derive a tree of strings, and apply `drawTree` to that.


<lang haskell>import Data.Tree (Tree (..), drawTree)
<lang haskell>import Data.Tree (Tree (..), drawTree)