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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Baking the Y Combinator from Scratch

125 点作者 mprast大约 1 个月前

8 条评论

justonceokay大约 1 个月前
Anyone interested in this might get a kick out of the book “To Mock A Mockingbird”.<p>The first half of the book is an almost exhaustive exploration of self-referential riddles. Like “if the barber shaves everyone who doesn’t shave themselves, who shaves the barber?” and “if one gremlin always tells the truth and the other always lies, how can you ask them for directions?”<p>The second half of the book is a rigorous examination of combinatorial logic through an analogy of birds who make calls depending on the calls of other birds they hear. It touches on function composition,recursion, fixed points, godels theorems, and the Y combinator (the mockingbird).<p>My only gripe with the book is that it stays completely within the bird metaphor, and doesn’t always explicitly state the underlying math concept.
sva_大约 1 个月前
If anyone wants this in a humorous 1 hour format, watch the legendary Jim Weirich (rip) explain it here: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=FITJMJjASUs" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=FITJMJjASUs</a><p>Don&#x27;t be discouraged that it is in Ruby as the concepts are completely general. Great watch even though I never coded a line of Ruby.
mkagenius大约 1 个月前
Is there a technique to remember this? I will understand it today and forget after a few weeks.
评论 #43638317 未加载
评论 #43638319 未加载
评论 #43639727 未加载
评论 #43639364 未加载
fritzo大约 1 个月前
From scratch it&#x27;s also easy dress up a quoted Y combinator as in Löb&#x27;s theorem. Start with the usual Y combinator<p><pre><code> Y = \f. (\x.f(x x)) (\x.f(x x)) : (p -&gt; p) -&gt; p </code></pre> which can produce a thing of type p from a function f : p -&gt; p.<p>Now Löb&#x27;s theorem states that []([]p -&gt; p) -&gt; []p, which can be read, &quot;if you have the source code to transform (the source code of a thing of type p) to a thing of type p, then you can produce the source code for a thing of type p&quot;. Let&#x27;s embellish Y using {} to denote the quoting comonad.<p><pre><code> Y&#x27; = \{f}. (\{x}.{f{x{x}}}) {\{x}.{f{x{x}}}} : []([]p -&gt; p) -&gt; []p </code></pre> To get there, just add quotes as needed: f must be quoted, f&#x27;s result must be quoted, and f takes a quoted input.
mkckto大约 1 个月前
Here&#x27;s a write-up I did on deriving the Y combinator from Lawvere&#x27;s fixed-point theorem: <a href="https:&#x2F;&#x2F;emarzion.github.io&#x2F;Y-Comb&#x2F;" rel="nofollow">https:&#x2F;&#x2F;emarzion.github.io&#x2F;Y-Comb&#x2F;</a>
tromp大约 1 个月前
&gt; you technically can&#x27;t do name = term<p>But you can do<p><pre><code> let name = term in term2 </code></pre> by de-sugaring it to<p><pre><code> ((λname. term2) term)</code></pre>
评论 #43639040 未加载
programjames大约 1 个月前
I&#x27;m a constructivist, but I still believe in proof by contradiction. In fact, I don&#x27;t think you can believe in proof by contradiction <i>without</i> constructivism. How do you know you can take an arbitrary proof P, and show it leads to a contradiction, if you don&#x27;t even know you can touch P to begin with?<p>Anyway, how I would construct a proof by contradiction is:<p>1. Suppose you want to know if there exists a proof P of length less than N.<p>2. Do the usual &quot;proof by contradiction&quot; with a placeholder P.<p>3. You can write a very short algorithm that then plugs in all 2^N possible proofs into your proof by contradiction algorithm.<p>4. And voila! You have a constructive proof.
yayitswei大约 1 个月前
At first I thought they were going to implement it in MIT Scratch.
评论 #43650269 未加载