Lichen

Annotated tests/nested_lambda.py

511:b99c11afb6f5
2017-01-27 Paul Boddie Configure the Makefile using generated secondary Makefiles, replacing the debug-specific Makefile and permitting the selection of included source files.
paul@2 1
a = 4
paul@2 2
paul@2 3
def f(x):
paul@266 4
    #   f.$l0          f.$l0.$l0
paul@43 5
    g = lambda y, x=x: lambda z, x=x, y=y: (x, y, z, a)
paul@2 6
    return g
paul@2 7
paul@266 8
print f                 # __main__.f
paul@266 9
print f(1)              # __main__.f.$l0
paul@266 10
print f(1)(2)           # __main__.f.$l0.$l0
paul@266 11
paul@2 12
result = f(1)(2)(3)
paul@214 13
print result[0]
paul@214 14
print result[1]
paul@214 15
print result[2]
paul@214 16
print result[3]
paul@266 17
print result            # (1, 2, 3, 4)