TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

PHP as sexy as Scheme using lambdas and recursion

36 pointsby KrisJordanover 15 years ago

11 comments

shaunxcodeover 15 years ago
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>
jacquesmover 15 years ago
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_eclipseover 15 years ago
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 未加载
rbanffyover 15 years ago
"as sexy as Scheme"?! No way.
评论 #782843 未加载
swolchokover 15 years ago
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 未加载
mgreenbeover 15 years ago
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>.
henningover 15 years ago
This does nothing to address PHP's biggest problem, which is the user base's lack of motivation to migrate away from PHP 4.
andrewvcover 15 years ago
There's a quote about pigs and lipstick that might apply here.
评论 #782481 未加载
hamidpover 15 years ago
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 未加载
JoelMcCrackenover 15 years ago
no
jawngeeover 15 years ago
'false' still equals 0.
评论 #783098 未加载