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.

Three Little Birds – Deriving the Y Combinator

74 pointsby eggsbyover 12 years ago
Just what the world needs, another post explaining the y combinator! Hope someone can glean some information from this, I learned a fair bit in writing it :)

3 comments

brianbernsover 12 years ago
As a professional programmer with a strong interest in functional programming, but none of the formal background, I should be the perfect reader for this article. Unfortunately, I found it to be a complete syntactic and semantic mess. I'll enumerate a few of the problems that tripped me up as I read:<p>* The underlying metaphor is poorly explained. E.g. The identity bird: "when you call out a bird to it it simply calls that bird back to you". The notion of "calling out a bird" is awkward and confusing. On first reading, it seems to imply that one calls out the <i>name</i> of a bird, which is simply wrong. I understand that birds represent higher-order functions, but if I didn't, I would never grasp it from reading this article. (I doubt that Smullyan was this sloppy in his original description of the metaphor.)<p>* The mockingbird "duplicates its input". No, it doesn't. It applies its input to itself, which is totally different from duplicating it. The next sentence is also confusing at best: "If you call some bird x to the mockingbird it will call back as if the bird x had called out to itself". The phrase "as if" is wrong and misleading, and bird x is <i>not</i> calling out some unspecified value to itself. A better description is that the <i>mockingbird</i> function calls out bird x to bird x. That's a huge difference.<p>* I had to read this phrase about five times before I could parse it: "The mental giants who computed before computers spoke to this magical bird chiefly for this purpose". And once parsed and understood, it still fails to explain why we're suddenly talking about factorials instead of birds. What makes this bird metaphorically "mechanical" or "foreign" is mysterious. It just does factorials somehow because it doesn't "follow the rules of regular combinator birds but it will follow some". Come again?<p>* The next sentence is where I started to give up: "Initially we call the strange factorial out to the mockingbird, which calls back the same thing as calling the strange bird to itself". Is the "fact" variable supposed to be the strange factorial? What is the strange bird? None of this terminology actually appears in the function that is supposedly being explained here. I had to ignore the text and work out the purpose of the function myself.<p>I'm sure there's value in this metaphor - I love the other Smullyan books that I've read and have a lot of respect for his careful puzzle-making. But I'm afraid this article doesn't do him justice as written.
评论 #5008066 未加载
评论 #5007244 未加载
raganwaldover 12 years ago
Where did I misplace my +100 wand? Great post, combinators are a not-so-hidden passion of mine and they inspire a lot of really practical applications in JavaScript and Ruby.
评论 #5006086 未加载
tesmar2over 12 years ago
Jim Weirich derives the Y combinator in pure Ruby here:<p><a href="http://vimeo.com/45140590" rel="nofollow">http://vimeo.com/45140590</a><p>EDIT: Correct video <a href="http://www.youtube.com/watch?v=FITJMJjASUs" rel="nofollow">http://www.youtube.com/watch?v=FITJMJjASUs</a><p>It is some of the ugliest ruby code I have ever seen, but it was something amazing to watch happen live.
评论 #5005841 未加载
评论 #5005909 未加载