3 ms·
> Hacker News really doesn't like PHP. But Y? function Y($F) { $func = function ($f) { return $f($f); }; return $func(function ($f) use($
by scotty79 14y ago
> Hacker News really doesn't like PHP.
But Y?
function Y($F) {
$func = function ($f) { return $f($f); };
return $func(function ($f) use($F) {
return $F(function ($x) use($f) {
$ff = $f($f);
return $ff($x);
});
});
}
- debacle 14y agoYou can write that code in almost any language and it will look bad and be hard to mentally parse.
- scotty79 14y agoBut that's beloved ycombinator! Non-godlike developer can't mentally parse this unless he reads this: http://worrydream.com/AlligatorEggs/ http://worrydream.com/AlligatorEggs/
- frewsxcv 14y agoThat might be true, but it's a lot easier to do in PHP than Python for example
- debacle 14y agoI looked at rosetta code - they both look pretty similar in clarity. Compare to JavaScript or R, which are much more legible.
- jasonlotito 14y agoHonestly, and with complete sincerity, that just means you're a bad programmer. It has nothing to do with the language. And trying to correlate the two is makes you look even worse.
- astrange 14y agoDid you mean to reply to a different comment?
- jasonlotito 14y agoNo. Why do you think the parents sample code is an example of quality code?
- astrange 14y agoI think there's a grammar problem with "that means you're a bad programmer". Anyway, that's a joke implementation of the Y combinator[1] in PHP. [1] http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combin...
- ruok0101 14y agoI would fire anyone who wrote code like this in a real app. Surely there can be another way to achieve the same result with a much cleaner and maintainable implementation. Code like this is written by prima donna programmers who have no respect that other people will someday have to read and maintain their code. I say this about any similarly-convoluted code, not just in PHP.