Visualize a tree: Difference between revisions

Content added Content deleted
Line 1,976: Line 1,976:
===Functional composition===
===Functional composition===
{{Trans|Javascript}}
{{Trans|Javascript}}
{{Trans|Haskell}}
<lang python>from operator import (add)
<lang python>from operator import (add)
import itertools
import itertools


# drawTree :: Tree String -> String
def drawTree(tree):
return '\n'.join(draw(tree))




Line 2,026: Line 2,030:
'type': 'Node'}
'type': 'Node'}
print(
print(
'\n'.join(draw(tree))
drawTree(tree)
)</lang>
)</lang>
{{Out}}
{{Out}}