具有高阶函数的 Web 编程
我们在课堂上学习高阶函数,我们的教授提到它们对于网络编程很有用。我不确定在什么情况下这是正确的,并且想知道是否有人在一些常见的 Web 编程任务中拥有高阶函数的经验,以及它们在什么情况下有用。
我读了我们的书,但没有提到网络编程,我想这只是教授提到的题外话,但这激发了我的兴趣。
谢谢!
We are learning higher-order functions in our class and our professor mentioned that they can be useful for web programming. I'm unsure as to what cases in which that would be true and was wondering if anyone had any experiences with higher-order functions in some common web programming tasks, and in what situations they would be useful.
I read through our book, but web programming wasn't mentioned, I suppose it was just something the professor mentioned off topic, but it sparked my interest a bit.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不太确定你的教授可能谈论的是哪些情况,但 JavaScript 中大量使用了高阶函数。高阶函数的一个简单示例(将函数作为参数和/或返回函数作为结果的函数)将是 jQuery read() 函数:
一个简单的示例,是的...但它演示了更高阶函数的有用性命令功能即可。
I'm not exactly sure which cases your professor might have been talking about, but higher order functions are used heavily in JavaScript. A simple example of a higher order function (a function taking a function as a parameter and/or returning a function as a result) would be the jQuery ready() function:
A simple example, yes...but it demonstrates how useful higher order functions can be.
播放,(Scala) Lift (Scala) 、 SeaSide (Smalltalk) 和 Webmachine (< a href="http://bitbucket.org/justin/webmachine/wiki/Home" rel="nofollow">Erlang)
三个 Web 框架严重依赖函数理念,例如高阶函数。
Play, (Scala) Lift (Scala) , SeaSide (Smalltalk) and Webmachine (Erlang)
are three web frameworks the rely heavily on functional ideoms such as higher-order-functions.
Clojure 在优秀的 Ring 框架中广泛使用高阶函数进行 Web 开发。请观看这段出色的视频,其中解释了一些概念。
基本思想是:
Clojure makes extensive use of higher order functions for web development in the excellent Ring framework. See this excellent video which explains some of the concepts.
The basic idea is: