micropython

tests/lambda.py

222:d63a8400ce56
2009-05-24 Paul Boddie Moved logic from CheckFrame into separate CheckContext, CheckClassContext instructions used in a sequence of generated instructions. Fixed usage of the exception register in the RSVP machine.
     1 #!/usr/bin/env python     2      3 identity = lambda x: x     4 add_2 = lambda a, b=2: a + b     5      6 def f(c):     7     return lambda a, b=c: a + b     8      9 def g(f, x):    10     return f(x)    11     12 identity(1)    13 add_2(1)    14 g(identity, 1)    15 g(add_2, 1)    16 g(f(3), 1)    17     18 # vim: tabstop=4 expandtab shiftwidth=4