Jason Zheng wrote:
I'm wondering why python still has limited lambda support. What's
stopping the developers of python to support more lisp-like lambda
function?
See boo and its support for closures: http://boo.codehaus.org/
http://boo.codehaus.org/Closures
It works with "def" or "do", or single-line closures use {}.
x = def:
print "hello"
A closure with parameters:
c = def(x1 as int, x2 as string):
print x1, x2
Single line closures use {}
c = {print("hello")}
Single line with parameters
c = {item as string | print(item)}
#Passing closures to a method as a parameter:
def mymethod(c as callable):
c()
x = mymethod( {print("hello")} )
#passing a multi-line closure as a parameter:
x = mymethod() do():
print "hello"
#Adding a closure to an event handler:
button.Click += def ():
print("${button} was clicked!")
--
http://mail.python.org/mailman/listinfo/python-list