[IronPython] lambda form

PhiHo Hoang phiho.hoang at rogers.com
Sat May 7 16:03:38 CEST 2005


Greetings,

    Does IronPython support lambda form ?

    Is this make_inc correct ?

    Thanks,

    PhiHo

>>> def make_inc(n):
...     return lambda x : x + n
...
>>> f = make_inc(100)
>>> f(1)
IronPython.Objects.PythonNameError: name 'n' is not defined
   at IronPython.Objects.Frame.GetGlobal(String name)
   at input_98.lamda$0$f10(Object x)
   at IronPython.Objects.Function1.Call(Object arg0)
   at IronPython.Objects.Ops.Call(Object func, Object arg0)
   at input_100.Run(Frame frame)
   at IronPython.Hosting.PythonEngine.DoOneInteractive(Frame topFrame)
   at IronPython.Hosting.PythonEngine.RunInteractive()
>>>



More information about the Ironpython-users mailing list