Jump to content

Tree datastructures: Difference between revisions

→‎Procedural: golf->troll
(→‎{{header|AppleScript}}: Rethought use of glfing (see talk page); but please read new notes section of task please.)
(→‎Procedural: golf->troll)
Line 1,037:
 
<lang python>from pprint import pprint as pp
from collections import namedtuple
 
def to_indent(node, depth=0, flat=None):
Line 1,066 ⟶ 1,065:
print('Start Nest format:')
nest = ('RosettaCode', [('rocks', [('code', []), ('comparison', []), ('wiki', [])]),
('mocks', [('golfingtrolling', [])])])
pp(nest, width=25)
 
Line 1,088 ⟶ 1,087:
('wiki', [])]),
('mocks',
[('golfingtrolling', [])])])
 
... To Indent format:
Line 1,097 ⟶ 1,096:
(2, 'wiki'),
(1, 'mocks'),
(2, 'golfingtrolling')]
 
... To Nest format:
Line 1,106 ⟶ 1,105:
('wiki', [])]),
('mocks',
[('golfingtrolling', [])])])</pre>
 
===Functional===
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.