既然 Scala 的例子用了 lambda function,
小弟也來幫忙改寫一下 Python 的部份;
如果上面的 lambda function 其實只會用到一次的話也不用特地宣告之,
list comprehension 可以直接解決,亦不失其可讀性:
==== <Example_1>
xs = [-1, -2, -3, 0, 1, 2, 3]
print len([x for x in xs if x**2 > 5])
### equivalent to:
# square = lambda x: x**2
# isGreaterThan5 = lambda x: x > 5
# print len([x for x in xs if isGreaterThan5(square(x))])
==== </Example_1>