在python中的lambda表达式和接近Lisp中的表达式
<!-- lang: python -->
f = lambda x: x*x
print f(4)
而函数形式则为
<!-- lang: python -->
def f(x):
return x*x
print f(4)
在Lisp中形式为
<!-- lang: python -->
(define f (lambda (x) (* x x) ) )
(f 4)
python中的lambda表达式有学习Lisp的痕迹,对于喜欢函数式编程的且喜欢Lisp的同学们可以考虑转到Python看看,毕竟Python也是有相当一部分是函数式风格,并且继承了很多Lisp的特征。