Visualize a tree: Difference between revisions
m
→Functional Python: Small edits to a couple of primitives
m (→Functional composition: (edited a comment line)) |
m (→Functional Python: Small edits to a couple of primitives) |
||
Line 2,202:
)
def lmrBuild(
def go(wsTree):
nChars, x = wsTree['root']
Line 2,382:
def go(x):
return Node(f(x['root']))(
)
return lambda tree: go(tree)
Line 2,391:
'''Right to left reduction of a list,
using the binary operator f, and
starting with an initial
'''
def g(x, a):
return f(a, x)
return lambda acc: lambda xs: reduce(
)
|