我在这里看到很多关于函数式语言的讨论。为什么你要使用传统语言而不是传统语言呢?他们在哪些方面做得更好?他们更不擅长什么?理想的函数式编程应用程序是什么?


当前回答

我敢打赌,当你使用以下方法时,你并不知道你在进行函数式编程:

Excel公式 石英的作曲家 JavaScript Logo(海龟图形) LINQ SQL js(或Lodash), D3

其他回答

它之所以流行起来,是因为它是控制复杂性的最佳工具。 看到的: ——西蒙·佩顿-琼斯演讲《哈斯凯尔的味道》幻灯片109-116 ——Tim Sweeney的《下一个主流编程语言:游戏开发者的视角

我一直对“下一件大事”持怀疑态度。很多时候,下一个大事件纯粹是历史的偶然,无论技术好坏,它都在正确的时间出现在正确的地点。例如:c++, Tcl/Tk, Perl。所有的技术都是有缺陷的,都非常成功,因为它们被认为要么解决了当时的问题,要么与根深蒂固的标准几乎相同,或者两者兼而有之。函数式编程可能确实很棒,但这并不意味着它会被采用。

But I can tell you why people are excited about functional programming: many, many programmers have had a kind of "conversion experience" in which they discover that using a functional language makes them twice as productive (or maybe ten times as productive) while producing code that is more resilient to change and has fewer bugs. These people think of functional programming as a secret weapon; a good example of this mindset is Paul Graham's Beating the Averages. Oh, and his application? E-commerce web apps.

自2006年初以来,也有一些关于函数式编程和并行的讨论。因为像Simon Peyton Jones这样的人至少从1984年开始就一直在担心并行性,所以在函数式语言解决多核问题之前,我不会屏住呼吸。但它确实解释了目前一些额外的话题。

In general, American universities are doing a poor job teaching functional programming. There's a strong core of support for teaching intro programming using Scheme, and Haskell also enjoys some support there, but there's very little in the way of teaching advanced technique for functional programmer. I've taught such a course at Harvard and will do so again this spring at Tufts. Benjamin Pierce has taught such a course at Penn. I don't know if Paul Hudak has done anything at Yale. The European universities are doing a much better job; for example, functional programming is emphasized in important places in Denmark, the Netherlands, Sweden, and the UK. I have less of a sense of what's happening in Australasia.

我同意第一点,但是时代变了。公司会做出回应,即使他们是后期采用者,如果他们看到有一个优势。生活是动态的。

90年代末,他们在斯坦福教授哈斯凯尔和ML。我相信卡内基梅隆大学、麻省理工学院、斯坦福大学和其他一些好学校正在向学生们展示它。

我同意大多数“在网络上公开关系数据库”的应用程序将在很长一段时间内继续这样做。对于这个问题,Java EE、. net、RoR和PHP已经演化出了一些非常好的解决方案。

您发现了一些重要的问题:这可能是其他方法无法轻松解决的问题,而这些方法将促进函数式编程。那是什么?

大规模多核硬件和云计算会推动它们向前发展吗?

一些想法:

The debate between FP and imperative programming (OO, structured, etc), has been raging since Lisp versus Fortran. I think you pose excellent questions but recognize that they are not especially new. Part of the hoopla over FP is that we seem to be recognizing that concurrency is very difficult, and that locks and other mechanisms in OO (e.g. Java) are just one solution. FP offers a refreshing sea change with ideas such as Actors and the power of stateless computing. To those wrestling with OO, the landscape seems highly appealing. Yes, schools teach FP. In fact, the University of Waterloo and others offer Scheme in first year classes (reference here). Regarding the average programmer, I'm sure that the same arguments were given against C++ back in the early 1990s. And look what happened. If businesses can gain an advantage via a technology, you can bet that people will receive training.

这并不是说这是板上钉钉的事,也不是说在3-5年内不会出现反弹(一如既往)。然而,朝着计划生育的趋势是有好处的,值得关注。

为什么函数式编程很重要