phx13ye
2015-05-12 20:18:42 +08:00
不知道有啥好笑的,oop就不能fp?
Functional programming in non-functional languages
It is possible to use a functional style of programming in languages that are not traditionally considered functional languages.[42] For example, both D and Fortran 95 explicitly support pure functions.[43]
First-class functions have slowly been added to mainstream languages. For example, in early 1994, support for lambda, filter, map, and reduce was added to Python. Then during the development of Python 3000, Guido van Rossum called for the removal of these features.[44] However, he later changed his mind, and only reduce was removed,[45] though it remains accessible via the functools standard library module.[46] First-class functions were also introduced in PHP 5.3, Visual Basic 9, C# 3.0, and C++11[citation needed].
In Java, anonymous classes can sometimes be used to simulate closures;[47] however, anonymous classes are not always proper replacements to closures because they have more limited capabilities.[48] Java 8 supports lambda expressions as a replacement for some anonymous classes.
摘自维基百科