Commit 82249f21 authored by Stefan Behnel's avatar Stefan Behnel

enable working closure test case

parent 3bfab5f7
...@@ -43,6 +43,7 @@ True ...@@ -43,6 +43,7 @@ True
>>> inner_funcs = more_inner_funcs(1)(2,4,8) >>> inner_funcs = more_inner_funcs(1)(2,4,8)
>>> inner_funcs[0](16), inner_funcs[1](32), inner_funcs[2](64) >>> inner_funcs[0](16), inner_funcs[1](32), inner_funcs[2](64)
(19, 37, 73)
""" """
...@@ -120,18 +121,23 @@ def cy_twofuncs(x): ...@@ -120,18 +121,23 @@ def cy_twofuncs(x):
def more_inner_funcs(x): def more_inner_funcs(x):
# called with x==1
def f(a): def f(a):
def g(b): def g(b):
# called with 16
return a+b+x return a+b+x
return g return g
def g(b): def g(b):
def f(a): def f(a):
# called with 32
return a+b+x return a+b+x
return f return f
def h(b): def h(b):
def f(a): def f(a):
# called with 64
return a+b+x return a+b+x
return f return f
def resolve(a_f, b_g, b_h): def resolve(a_f, b_g, b_h):
# called with (2,4,8)
return f(a_f), g(b_g), h(b_h) return f(a_f), g(b_g), h(b_h)
return resolve return resolve
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment