TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

PHP as sexy as Scheme using lambdas and recursion

36 点作者 KrisJordan超过 15 年前

11 条评论

shaunxcode超过 15 年前
I for one think this is awesome - particularly for those of us who sling php for a living by day and read programming romance novels by night. My contribution in a similar vein can be found here: <a href="http://commonphp.blogspot.com/" rel="nofollow">http://commonphp.blogspot.com/</a>
jacquesm超过 15 年前
Well, it's been written somewhere that the longer you work on anything the bigger the chance that you'll have a bug-ridden implementation of lisp in there somewhere...
评论 #782425 未加载
nuclear_eclipse超过 15 年前
To be honest, I'm not quite sure what this article is trying to point out; lambda functions (and functional-style programming) have been a part of the PHP language for a very long time -- since PHP4 to be exact. It may not be as "sexy" to look at as Lisp et al, but it's certainly been doable.<p><pre><code> $fn = create_function( "$a", "return $a * 2" ); $list = array( 1, 2, 3, 4 ); $double = array_map( $fn, $list ); // array( 2, 4, 6, 8 ) </code></pre> or<p><pre><code> function my_filter( $a ) { return $a &#62; 10 ? true : false; } $list = array( 5, 10, 15, 20 ); $less = array_filter( $list, "my_filter" ); // array( 15, 20 )</code></pre>
评论 #783412 未加载
rbanffy超过 15 年前
"as sexy as Scheme"?! No way.
评论 #782843 未加载
swolchok超过 15 年前
1) It still has all those ugly sigils.<p>2) There is still a large body of "PHP coders" that don't code this way, don't expect others to code this way, and probably won't understand code written thus. The community <i>is</i> the language.
评论 #782492 未加载
评论 #782521 未加载
评论 #782515 未加载
mgreenbe超过 15 年前
PHP, welcome to the early 80s. Who knows, soon you might have real datatypes!<p>Does the Zend engine do TCO? When I search, Google thinks I mean "Total Cost of Ownership". All I can find is <a href="http://devzone.zend.com/article/1235" rel="nofollow">http://devzone.zend.com/article/1235</a>.
henning超过 15 年前
This does nothing to address PHP's biggest problem, which is the user base's lack of motivation to migrate away from PHP 4.
andrewvc超过 15 年前
There's a quote about pigs and lipstick that might apply here.
评论 #782481 未加载
hamidp超过 15 年前
I remember fiddling around with PHPs recursion and having it get very bad very quickly.<p>Why use lambdas and recursion with PHP when there's tons of languages that do it better?
评论 #782448 未加载
评论 #782989 未加载
JoelMcCracken超过 15 年前
no
jawngee超过 15 年前
'false' still equals 0.
评论 #783098 未加载