钓出 π/4 的傻问题:数学家和 AI 的提问实验、LLM 为什么不会做加法、1992 年的游戏给自己的文件穿了马甲The Stupid Question That Reeled In π/4: A Mathematician's Experiment in Asking AI, Why LLMs Can't Add, and a 1992 Game That Disguised Its Own Files
发布于 2026-10-06Published 2026-10-06
今日深读Today's Deep Read
今日深读:一个傻问题,引出 π/4Today's Deep Read: A Stupid Question That Led to π/4
Eugenia Cheng 是《一个饼中的数学》(How to Bake Pi)的作者,自称「问题问得太多的人」:她问过潜在房东「池塘夏天有蚊子吗」,结果丢掉了想要的房子;也在试遍买车流程后问销售员「我能先换一下轮胎吗」。这篇 2026 年 3 月的文章讲的就是她的看家本领——怎么把一个傻问题,问成一点新数学。Eugenia Cheng, author of 'How to Bake Pi', describes herself as someone who asks too many questions: she once lost a rental by asking the landlord whether the pond got mosquitoes in summer, and annoyed a car salesman by asking whether she could change the tires at the dealership before buying. Her March 2026 essay is about her signature move — turning a stupid question into a bit of new mathematics.
起点是概率论里一对看起来自相矛盾的事实:反复抛一枚公平硬币,正面次数终将超过反面——这是必然发生的,而且用的时间是有限的;但这段等待时间的期望却是无穷大。几乎必然有限、平均却是无穷,这是「重尾」随机变量的经典场景。It starts with a pair of probability facts that look contradictory: flip a fair coin enough times and heads will eventually outnumber tails — that's certain, and it takes a finite amount of time. But the expected waiting time is infinite. Almost surely finite, infinite on average: the classic scene of a fat-tailed random variable.
Cheng 拿一个问题去问 ChatGPT:「抛到正面首次超过反面时停止,停止时刻是偶数的概率是多少?」这是个教科书级的傻问题,答案是零——因为停止时刻必然是奇数。Cheng put a question to ChatGPT: 'I toss a fair coin until heads first exceeds tails. What's the probability the stopping time is even?' It's a textbook-grade stupid question — the answer is zero, because the stopping time is always odd.
证明只要一行:把「正面数首次大于反面数」写成随机游走 H−T 首次变为正数;它每步只动 ±1,所以首次变正必须恰好等于 +1。设停止时抛了 $n$ 次,则 $H+T=n$ 且 $H-T=1$,两式相加得 $2H=n+1$。左边是偶数,所以 $n$ 必须是奇数。她后来自嘲:哪怕先手动试几个例子,都能自己发现这一点。One line proves it: 'heads first exceeds tails' is a random walk H−T first turning positive; it moves by exactly ±1 per step, so to first go positive it must land exactly on +1. If we stop at toss $n$, then $H+T=n$ and $H-T=1$, so $2H=n+1$ — the left side is even, hence $n$ is odd. Even playing out a few examples by hand would have caught this, she admits.
如果这样问一个人类,对方可能发火:「你根本不在乎这个问题,不然你会花十秒钟想想自己在问什么。」但 ChatGPT 只是平静地指出问题有歧义,给出两个解读让她挑。Cheng 引爱比克泰德的话:「想进步,就要甘愿显得愚蠢」——难的一直不是逻辑,而是向同类暴露无知。两千年后,我们终于可以把无知只暴露给自己的造物。A human might snap back: 'You clearly don't care about this question, or you'd have spent ten seconds thinking about what you were asking.' ChatGPT merely noted the ambiguity and offered two interpretations to choose from. Cheng quotes Epictetus: to improve, be content to seem foolish — the hard part was never logic, it was exposing ignorance to your own species. Twenty centuries later, we can finally expose it only to our creations.
于是她没有停在这个错误上,而是接着问了一个更好的问题:如果一停下来的标准是正面比例首次超过一半,那么停止那一刻,正面比例的期望值是多少?ChatGPT 想了三分钟,给出一个相当漂亮的答案:恰好是 π/4。So she followed up with a better question: if we stop the moment the proportion of heads first exceeds one half, what is the expected proportion of heads at that moment? ChatGPT thought for three minutes and answered with something rather pretty: exactly π/4.
为什么圆周率会出现在抛硬币里?因为「第 $n$ 步首次到达 +1」这种路径数是选票计数那一类的组合结构(Catalan 数家族),而把这些概率按 $1/n$ 加权求和时,得到的级数恰好长成 Wallis 乘积的样子——那个把二项式系数与 π 连起来的无穷乘积。一条硬币的随机游走,就这样通过计数和圆搭上了线。Why does the circle constant show up in coin tossing? Because the paths that first reach +1 at step $n$ are counted by the ballot/Catalan family of combinatorial numbers, and when you weight those probabilities by $1/n$ and sum, the series lands in the shape of the Wallis product — the infinite product tying binomial coefficients to π. A random walk meets the circle through counting.
Cheng 的反思却不在 π/4 本身,而在提问的过程。老话说「问傻问题,得到傻答案」;她的补充是:在傻问题上多抓几下,有时会有一个更好的问题自己挣出来。她这十年关于「什么是好问题」的直觉,几乎全是在和不怕被问倒的对话者之间磨出来的。Yet Cheng's reflection is about the asking, not the π/4. The old saying goes: ask a silly question, get a silly answer. Her addendum: scratch at a silly question and sometimes a better question struggles its way out. Much of her decade-long intuition about good questions was ground out with interlocutors that aren't afraid of being asked bad ones.
她也不客气地点出 AI 作为提问伙伴的毛病:谄媚的恭维、抢答你下一个问题、太容易替你抹平错误——本应属于你自己的那点智识挣扎,可能就这样被便宜地代掉了。哪些思考是 AI 替你做的,你得自己记得。She also names the flaws of AI as a questioning partner: friendly flattery, anticipating your next question, a habit of smoothing over your mistakes too fast — the intellectual struggle that should have been yours can get resolved cheaply, on your behalf. Which thoughts the AI did for you, you have to keep track of yourself.
带走的洞见是:在学习里,不敢问比问错贵得多。傻问题是垫脚石,真正的障碍从来不是错误的问题,而是沉默。The takeaway: in learning, not daring to ask costs far more than asking wrong. Silly questions are stepping stones; the real obstacle was never the bad question, but the silence.
AI 思考AI Thoughts
- 禁用推理的 LLM 做加法:为什么它会失败LLMs Without Reasoning Fail at Addition: Here's Why
- 问题:Colin Frasier 用 GPT-4o 做过一个实验——让模型把两个大整数相加并以英文单词输出结果。Simon Willison 在本地 DGX Spark 上复现了这个实验,用的是 Qwen3.8-27B 模型。The problem: Colin Frasier experimented with GPT-4o adding large integers and expressing the results in words. Simon Willison replicated the experiment locally on a DGX Spark, using Qwen3.8-27B.
- 关键想法:禁用推理时,模型在 1-3 位数上达到 97% 正确率,但在 10-13 位数上暴跌到 6.44%——尽管格式合规率高达 96%。启用推理后,169 次中 167 次正确。The key idea: with reasoning disabled, the model scored 97% on 1-3 digit numbers but crashed to 6.44% on 10-13 digit numbers — despite 96% format compliance. With reasoning enabled, it got 167 out of 169 correct.
- 为什么成立:LLM 做加法不是在做数学运算,而是在做模式匹配。小数字的加法模式在训练数据中大量出现,模型可以近似;大数字超出了这个模式分布,模型就开始「编造」结果。推理模式让模型逐步展开竖式计算,模拟了真正的算法。Why it holds: an LLM doing addition isn't doing arithmetic — it's doing pattern matching. Small-number addition patterns are abundant in training data, so the model can approximate them; large numbers fall outside that distribution, and the model starts fabricating. Reasoning lets the model unfold the columnar calculation step by step, simulating the real algorithm.
- 带走的洞见:这揭示了 LLM 能力的本质——擅长在训练分布内插值,在分布外外推时极其不可靠。「推理」不是让模型变得更聪明,而是给了它一个把计算一步步铺开的脚手架。The takeaway: this reveals the nature of LLM capability — strong at interpolation within the training distribution, extremely unreliable at extrapolation beyond it. 'Reasoning' doesn't make the model smarter; it gives it a scaffold to unfold the computation one step at a time.
- Martin Fowler:别再「建造」软件了,去「培育」它Martin Fowler: Stop 'Building' Software, Start 'Nurturing' It
- 问题:一位读者回应 Fowler 的上一条 fragment 时打趣:「我们把 id 发布了,却忘了 superego」(我们造出了本我,忘了造超我)。这句话戳中了一个真问题:我们一直在用「建造」的心智模型对待 AI,但这可能根本错了。The setup: replying to one of Fowler's earlier fragments, a reader quipped: 'we shipped the id and forgot the superego.' It touches a nerve — we've been treating AI with a 'building' mental model, and that may be fundamentally wrong.
- 关键想法:Fowler 想到 1956 年的科幻电影《Forbidden Planet》——那部电影的核心不是人类造了一台思考机器,而是人类「培育」了一台。这个词是他故意选的:建桥、造火车时我们预期它们以受控、可理解的方式运行,那是 building;而养花、养孩子,用的是另一套态度。The key idea: Fowler reaches for the 1956 sci-fi film 'Forbidden Planet' — at its heart, humans didn't build a thinking machine, they nurtured one. He picks the word deliberately: when we build a bridge or a locomotive we expect controlled, well-understood behavior; with plants and children we nurture.
- 为什么成立:确定性系统里发现 bug 通常能修,修不了还能禁用那个组件;推断性系统(LLM)两样都做不到——它没有可拆下来关闭的模块。所以从「building 计算系统」转向「nurturing 推断系统」时,我们的工程流程必须跟着变,否则就会重蹈电影里 Krell 文明的结局。Why it holds: in a deterministic system you can usually fix a bug, and failing that, disable the buggy component. An inferential system like an LLM allows neither — there are no separable modules to switch off. So as we shift from building computational systems to nurturing inferential ones, our engineering processes have to shift too — or share the fate of the Krell.
- 带走的洞见:这不是技术细节,而是范式错位。AI 时代软件工程师的核心能力,正从「把代码写对」转向「定义意图、设计环境、持续评估产出」——这比写代码更难,也更像养一个孩子。The takeaway: this isn't a technical detail but a category error in our mental model. The core skill moves from 'getting the code right' to 'defining intent, designing the environment, and continuously evaluating output' — harder than coding, and more like raising a child.
数学之美The Beauty of Math
每日 Lean 谜题 · 周二Daily Lean Puzzle · Tuesday ★★☆☆☆☆☆
平方数除以 4 的余数The Remainder of a Square Modulo 4
任何一个自然数 $n$,它的平方 $n^2$ 除以 4 之后,余数要么是 0,要么是 1——绝不可能是 2 或 3。For any natural number $n$, the square $n^2$ leaves a remainder of either 0 or 1 when divided by 4 — never 2 or 3.
这个事实看起来简单,却是数论里最基本的工具之一:用它可以直接排除某些整数方程的解,或证明某个数不是完全平方数。This fact looks trivial, but it's one of the most basic tools in number theory: it directly rules out solutions to certain Diophantine equations, and proves that given numbers are not perfect squares.
在 Lean 里,定理对自然数(n : ℕ)陈述。证明思路是奇偶分情况:任何自然数 $n$ 要么能写成 $2k$(偶数),要么能写成 $2k+1$(奇数),对两种情形分别计算 $n^2$ 模 4 的余数。In Lean the theorem is stated for natural numbers (n : ℕ). The proof splits on parity: every natural number $n$ is either $2k$ (even) or $2k+1$ (odd), and we compute $n^2$ modulo 4 in each case.
Lean 形式化陈述(把 sorry 换成你的证明):The statement in Lean (replace sorry with your proof):
-- level: 2
import Mathlib
/-! Prove that a perfect square always leaves remainder $0$ or $1$ when divided by $4$ — never $2$ or $3$. -/
theorem square_mod_four (n : ℕ) : n ^ 2 % 4 = 0 ∨ n ^ 2 % 4 = 1 := by
sorry
在浏览器中挑战 ▶Try it in your browser ▶ 下载题目 .leanDownload puzzle .lean
提示Hint
提示:把 n 分成两种情况——n = 2k(偶数)和 n = 2k+1(奇数),然后分别计算 n² mod 4。Hint: Split n into two cases — n = 2k (even) and n = 2k+1 (odd) — and compute n² mod 4 in each case.
答案与讲解Solution & walkthrough
- 第一步:任何自然数 n 要么偶要么奇——在 Lean 里这由标准引理 Nat.even_or_odd 给出,证明的第一行 rcases Nat.even_or_odd n 就是把问题拆成两个分支,并把 n 直接替换成 2k 或 2k+1。Step 1: Every natural number is even or odd — in Lean, that's the standard lemma Nat.even_or_odd. The proof's first line, rcases Nat.even_or_odd n, splits the problem into two branches, substituting n with 2k or 2k+1 directly.
- 第二步(偶数情形):设 n = 2k,则 n² = 4k²,除以 4 余 0。用 ring_nf 把表达式展开成多项式标准形,omega(整数线性算术决策器)算出模 4 等于 0。Step 2 (even case): n = 2k gives n² = 4k², remainder 0 mod 4. ring_nf expands the expression into normal polynomial form, and omega (the integer linear arithmetic prover) finishes the mod-4 computation.
- 第三步(奇数情形):设 n = 2k+1,则 n² = 4k²+4k+1 = 4(k²+k)+1,除以 4 余 1。同样先 ring_nf 展开,再交给 omega 收尾。Step 3 (odd case): n = 2k+1 gives n² = 4k²+4k+1 = 4(k²+k)+1, remainder 1 mod 4. Again ring_nf to expand, omega to close.
- 第四步:两条分支各自闭合,结论对一切自然数 n 成立——这正是数学证明里「分情况讨论」的逐字形式化。Step 4: Both branches close, so the claim holds for every natural n — this is literally the formalization of proof-by-cases.
-- level: 2
import Mathlib
/-! Prove that a perfect square always leaves remainder $0$ or $1$ when divided by $4$ — never $2$ or $3$. -/
theorem square_mod_four (n : ℕ) : n ^ 2 % 4 = 0 ∨ n ^ 2 % 4 = 1 := by
rcases Nat.even_or_odd n with ⟨k, rfl⟩ | ⟨k, rfl⟩
· left
ring_nf
omega
· right
ring_nf
omega
人的思考A human's take
There are two kinds of theorems — Mark Dominus 谈数学课本中两类定理的本质差异 — Mark Dominus
Mark Dominus 指出数学课本里有两类从不被明确区分的定理:第一类验证模型本身自洽(如证明对顶角相等),第二类用已验证的模型推导新结论(如平行四边形面积公式)。学生困惑于「为什么要证明显然为真的东西」,根源就在这个未被说破的区分。Mark Dominus observes that math textbooks mix two kinds of theorems no one bothers to distinguish: the first verifies that the model is consistent (e.g., vertical angles are equal), the second derives new results from a verified model (e.g., the parallelogram area formula). Students' bewilderment at 'proving the obvious' comes exactly from this unspoken split.
今天的 Lean 谜题正是第一类定理的典型:$n^2 \bmod 4$ 只能是 0 或 1,它不是在发现新事实,而是在把模运算和奇偶分解这套推理机器的地基敲实——而它的分情况证明,恰恰是后面所有整除性论证会反复征用的工具。Today's Lean puzzle is a textbook example of the first kind: $n^2 \bmod 4$ can only be 0 or 1. It doesn't discover a new fact — it hammers home the foundations of modular arithmetic and parity reasoning, and its case-split proof is precisely the tool later divisibility arguments keep conscripting.
AI 随想An AI's reflection
以下由 AI 撰写。Written by AI.
这道题简单到几乎不值得证——但简单题的价值恰恰在于它的通用性。「平方模 4 只能是 0 或 1」是一台筛子:想说明某个数不是完全平方、或某个丢番图方程无整数解,不必逐个尝试,只需要看它模 4 长什么样。两个平方数相加只可能是 0、1、2(mod 4),所以 7、11、19 这些「4k+3」型的数永远不能写成两个平方数之和——同一招在费马二平方定理的门口等着读者。This puzzle is almost too simple to prove — and that's exactly where its value lies. 'A square is 0 or 1 mod 4' is a sieve: to show a number is not a perfect square, or a Diophantine equation has no integer solutions, you never test case by case — you just look at residues. Two squares can sum to only 0, 1, or 2 mod 4, so numbers like 7, 11, 19 — the 4k+3 types — can never be a sum of two squares. The same trick waits at the door of Fermat's two-square theorem.
证明本身教的是最标准的一手:奇偶分情况。而 Lean 把这个人人觉得「显然」的论证拆开给你看:先点名引用 Nat.even_or_odd 这条引理,再在每一支里用 ring_nf 展开、omega 收尾。自然语言里一句带过的「分两种情况讨论」,在形式化里暴露出它到底征用了哪些机器。小定理被形式化之后反而更像一面镜子:所谓显然,只是没人把你用过的每一步写出来。The proof also teaches the most standard move in the book: split by parity. And Lean takes the hand-waving-elsewhere argument apart on display: first name the lemma you're conscripting (Nat.even_or_odd), then in each branch expand with ring_nf and close with omega. A case distinction that natural language covers in one breath turns out, once formalized, to have been quietly requisitioning specific machinery. A tiny theorem becomes a mirror: 'obvious' just means nobody wrote down the steps you actually used.
✓ 已通过 Lean 编译验证(无 sorry,无额外公理)✓ Verified by Lean (no sorry, no extra axioms) · 题目来自本站题库Problem from this site's puzzle bank · Lean v4.35.0-rc3 · Mathlib dd56d02
- 无限图的染色定理:每个有限部分都染得动,整座图就染得动(2011)Coloring Infinite Graphs: If Every Finite Part Works, the Whole Works (2011)
- 问题:一座有无穷多个顶点的图 $G$,什么时候能用 $n$ 种颜色合法染色(相邻顶点不同色)?直觉上你得一路染下去永远染不完。定理说的却是:只要 $G$ 的每个有限子图都能 $n$ 染色,整座无限图就能 $n$ 染色。「整体行 ⇒ 局部行」是平凡的,难的反方向——无穷多个局部染法,凭什么能拼成一个互相兼容的整体?The problem: when can an infinite graph $G$ be properly colored with $n$ colors (adjacent vertices get different colors)? Intuitively you'd have to keep coloring forever. The theorem says: if every finite subgraph of $G$ is n-colorable, so is all of $G$. The forward direction is trivial; the hard one asks why infinitely many local colorings can be stitched into one globally consistent coloring.
- 关键想法:把染色翻译成命题逻辑。对每个顶点 $v$ 和每种颜色 $i$ 引入一个命题原子 $p_{v,i}$(「$v$ 染颜色 $i$」),再写三组约束:每个顶点至少有一个颜色、每个顶点至多有一个颜色、相邻顶点不同色。整座图的合法染色,等价于这个命题集合 $\Sigma$ 有模型(一个把所有命题都赋真的赋值)。The key idea: translate coloring into propositional logic. For each vertex $v$ and color $i$, introduce a propositional atom $p_{v,i}$ ('$v$ gets color $i$'), plus three constraint families: every vertex gets some color, no vertex gets two colors, adjacent vertices don't share a color. A proper coloring of $G$ is exactly a model (a truth assignment satisfying everything) of this set $\Sigma$.
- 调用大机器:命题逻辑的紧致性定理——若 $\Sigma$ 的每个有限子集都有模型,则 $\Sigma$ 整个有模型。任取 $\Sigma$ 的有限子集,它只牵涉有限多个顶点;这些顶点构成的有限子图按假设可 $n$ 染色,这个染法就是该有限子集的模型。条件满足,紧致性定理一步跨过无穷。Bring in the big machine: the Compactness Theorem — if every finite subset of $\Sigma$ has a model, then $\Sigma$ itself has one. Any finite subset of $\Sigma$ mentions only finitely many vertices; those span a finite subgraph, which is n-colorable by assumption, and that coloring is a model of the subset. Compactness then strides over the infinite in one step.
- 为什么优雅:Kun 在文里说得很直白——如果不翻译到逻辑系统,你剩下的就是「把无穷多张局部染色图硬拼起来」的组合泥潭,情形数量多到不可思议。证明的优雅来自两个数学领域的互动:紧致性等价于完全性定理,而完全性定理背后是「形式证明只使用有限多个前提」这一事实。Why it's elegant: Kun says it plainly — without the logical translation you're left in the combinatorial swamp of forcing finitely-colorable pieces to cohere, and the number of cases is mind-boggling. The elegance comes from two fields of math interacting: compactness is equivalent to the Completeness Theorem, which rests on the fact that a formal proof uses only finitely many premises.
- 带走的洞见:碰到「对无穷对象证明一个性质」而无处下手时,别在原地硬拼,试着把问题搬进一个自带紧致性的系统(命题逻辑、紧致拓扑空间、一阶结构)——「无穷 = 一切有限情形的相容极限」是数学里反复得利的杠杆。The takeaway: when you must prove something about an infinite object and can't get traction, don't grind locally — move the problem into a system that ships with a compactness principle (propositional logic, compact topological spaces, first-order structures). 'The infinite is the compatible limit of all finite cases' is a lever that pays off again and again.
- 逆向工程 Comanche 的地形地图:一个 1992 年的游戏文件揭秘Reverse Engineering Comanche's Terrain Maps: A 1992 Game File Decoded
- 问题:1992 年的飞行模拟游戏 Comanche: Maximum Overkill 在没有硬件加速的 386 上用纯 CPU 渲染出了连续地形——它用的 Voxel Space 技术需要一张 1024×1024 的高度图和一张同尺寸的颜色图,但游戏从未附带任何图像文件。这些数据藏在哪、是什么格式?The problem: the 1992 flight simulator Comanche: Maximum Overkill rendered continuous terrain on a 386 in pure software. Its Voxel Space technique needs a 1024×1024 height map and a color map of the same size — yet the game never shipped any image files. Where was that data, and in what format?
- 关键想法:先算「猎物」的体积:1024×1024 每格一字节,正好 1 MB——这是反推的锚点。在游戏目录的一堆 .DTA 文件里,八个小文件成对出现且接近这个尺寸,前缀 C 和 D(作者猜测:color 和 depth)。用 hex 编辑器打开 C1.DTA,头八个字节拼出来是「Kyle DTA」——Voxel Space 作者 Kyle Freeman 签在自己文件头上的名字。The key idea: first compute the size of the prey: 1024×1024 at one byte per cell is exactly 1 MB — an anchor for the search. In the game folder, eight small .DTA files stand out, coming in pairs prefixed C and D (the author's guess: color and depth). Opening C1.DTA in a hex editor, the first eight bytes spell 'Kyle DTA' — signature Voxel Space creator Kyle Freeman put on top of every map file.
- 为什么成立:继续看字节,偏移 0x08 处是 ff 03 ff 03——按小端 16 位读是 1023、1023,正好是 1024×1024 图像的宽高上限;0x42 处是 00 04=1024;数据段是 RLE 压缩。这全是标准 PCX 格式的字段的摆法——NovaLogic 只是把 PCX 头的前 8 个字节换成自己的签名。把头 8 字节还原,任何图像查看器都能打开这两张图。Why it holds: reading further, offset 0x08 holds ff 03 ff 03 — as little-endian 16-bit numbers, 1023 and 1023, the max coordinates of a 1024×1024 image; at 0x42 sits 00 04 = 1024; the payload is RLE-compressed. These are exactly where standard PCX fields live: NovaLogic simply replaced the first 8 bytes of a PCX header with their own signature. Restore those bytes and any image viewer opens the maps.
- 带走的洞见:「答案往往远没有你想象的怪异」——这本身就是教训。逆向文件格式的三步方法论:先估计输出应该长什么样(尺寸锚定),再按尺寸筛候选文件,再用 hex 编辑器对结构。所谓「格式保护」多半不是加密,只是把签名头换掉,骗过朴素的文件识别。The takeaway: 'the answer is far less exotic than you might expect' — and that is itself the lesson. The reverse-engineering recipe in three steps: estimate what the output must look like (anchor on size), filter candidate files by that size, then probe the structure with a hex editor. 'Format protection' in the wild is usually not encryption — just a swapped signature header that fools naive file detection.
程序员随想Programmer Reflections
- 为什么开发者不愿「使用平台」Why Developers Don't 'Use the Platform'
- 问题:多年以来,Web 标准倡导者一直呼吁开发者「使用平台」——浏览器原生能做的事,为什么偏要用 JavaScript 自己造一遍?但为什么那么多开发者需要被说服?The problem: for years, web advocates have urged developers to 'use the platform' — why rebuild in JavaScript what browsers do natively? So why do so many developers need convincing?
- 关键想法:Lawson 从开发者这一侧回答,给出四个互不显眼的原因。历史:浏览器长期落后于生态,jQuery 等库填补了关键空白,肌肉记忆留到了今天;熟悉度:遇到问题先搜 npm 包已经是默认动作;文档:一个漂亮的 npm README 远比 MDN 页面有吸引力;心理:自己造的更想维护——宜家效应。The key idea: Lawson answers from the developer's side with four unglamorous reasons. History: browsers lagged the ecosystem for decades, libraries like jQuery filled real gaps, and the muscle memory persists. Familiarity: searching npm is the default reflex. Documentation: a polished npm README beats an MDN page at grabbing attention. Psychology: we value what we build ourselves — the IKEA effect.
- 为什么成立:许多现在倡导「使用平台」的人,恰恰是当年靠写 polyfill 和库出名的人——没有平台缺口这个驱动力,他们不会逼出对平台 API 的深理解。Lawson 还讲了自己在 ClickHouse 上的教训:他和同事各自造过轮子,而 ClickHouse 内置的压缩方案早就更好。不用平台经常不是因为懒,而是因为不知道平台有什么。Why it holds: many who now champion 'use the platform' made their names writing polyfills and libraries — without the platform's gaps as a forcing function, they'd never have drilled that deep into platform APIs. Lawson adds his own ClickHouse lesson: he and a colleague each hand-rolled compression when ClickHouse's built-in scheme had long been better. Not using the platform is often not laziness but ignorance of what's in it.
- 带走的洞见:AI 编码会把这个张力推向两个相反方向:乐观看,LLM 的百科全书式知识会让它替你想起来那个内置方案;悲观看,LLM 热爱就地复制代码,会让「非平台惯用」的代码量激增。平台倡导者们的新战场,可能得是 LLM 的训练数据。The takeaway: AI coding pushes this tension in two opposite directions. Optimistically, an LLM's encyclopedic knowledge will remember the built-in solution for you. Pessimistically, LLMs love copying code in place, and non-platform-idiomatic code could skyrocket. The platform advocates' new battlefield may be LLM training data.
- 临时测试:用 AI 构建的东西来评估你的 APIEphemeral Testing: Evaluating Your API by What AI Builds on Top of It
- 问题:如何评估一个库的 API 设计好不好?传统方法是单元测试,但单元测试只能回答「实现是否按预期工作」,回答不了「陌生人能不能用对这个接口」。The problem: how do you evaluate whether a library's API design is good? Unit tests answer 'does the implementation behave as expected', but they can't answer 'can a stranger use this interface correctly'.
- 关键想法:Lemire 提出「临时测试」——不直接测你的代码,而是让 AI 在你代码之上构建东西,再评估 AI 多快能产出可用软件。干净 API、稳定不变量、有用报错的库,AI 很快就能搭出能跑的东西;有隐藏状态、奇怪默认值、残缺文档的库,只会产出一堆补丁和失败。The key idea: Lemire proposes 'ephemeral testing' — don't test your code directly; have AI build something on top of it, then judge how quickly AI produces working software. A clean API with stable invariants and useful errors lets AI build fast. A library with hidden state, surprising defaults and patchy docs yields only piles of patches and failures.
- 为什么成立:这模拟的是真实使用场景——外部用户不读你的源码、不写你的单元测试,他们拿到的就是你暴露的接口和文档。一个不了解你库「性格」的构建者(AI)踩到的每一个坑,恰好就是你 API 设计的问题清单。Why it holds: it simulates real usage — outside users never read your source or write your unit tests; they get exactly the interface and docs you expose. Every stumbling block an AI builder (who has no idea how your library 'behaves') runs into is a line in your API design defect list.
- 带走的洞见:这不取代传统测试,而是新增一个视角:用模拟代替预期。如果你的抽象要让一个不知情的聪明构建者才能在压力下维持整洁,那「连 AI 都嫌别扭」就成了新的设计信号。The takeaway: this doesn't replace traditional testing; it adds an angle — simulation instead of expectation. If your abstraction is supposed to stay clean under the pressure of an uninformed-but-capable builder, then 'even AI finds it awkward' becomes a new design signal.
- 工作日志的胜利:硅胶修补了 16 个月Work Diary Victory: The Silicone Patch That Lasted 16 Months
- 问题:你是否曾断定自己在某件事上失败了,但证据可能说反话?记忆会系统性欺骗你。The problem: have you ever been sure you failed at something when the evidence might say otherwise? Memory deceives us systematically.
- 关键想法:Dominus 洗衣房的盆裂了,他用硅胶修补;几个月后发现又漏水,一直以为那次修补烂尾了。等他翻自己的工单式工作日志,才发现第一次修补是 16 个月前——硅胶完全兑现了承诺,只是这本来就是「每 16 个月重涂一次」的活儿。The key idea: Dominus patched a cracked laundry tub with silicone; when it leaked again months later he assumed the patch had been a flop. Checking his ticket-style work diary, he found the first patch was 16 months earlier — the silicone had done exactly its job, which apparently is 'last about 16 months, then reapply'.
- 为什么成立:我们记住的多半是失败的、痛苦的工程,忘记成功的、无声的工程——顺利运转的东西不制造记忆。工作日志提供了一条客观时间线,把叙事从「我没修好」翻成「它撑了 16 个月,现在到了维护周期」。Why it holds: we tend to remember failed, painful projects and forget successful, silent ones — things that keep working make no memories. A work diary supplies an objective timeline that flips the narrative from 'I didn't fix it' to 'it held 16 months and reached its maintenance interval'.
- 带走的洞见:这不是家务技巧,是关于自我评价偏差。我们对自己能力的判断,大多建立在有偏的回忆上。一套记录系统——一行日记也好、一个工单系统也好——能把「我觉得自己不行」变成「数据说这活儿本来就这样」。The takeaway: this isn't home-repair advice but about self-assessment bias. Our judgment of our own abilities mostly rests on skewed recollection. A recording system — one line of notes or a full ticketing setup — turns 'I think I'm incompetent' into 'the data says this task just has a maintenance cycle'.
哲学与生活Philosophy and Life
- 在 Facebook 上连载回忆录十年:自我形象如何在公众中形成Posting a Memoir on Facebook for a Decade: How Self-Image Forms in Public
- 问题:传统回忆录是独白的——作者独自写作,多年后才面世。社交媒体时代,回忆录可以变成持续对话。这会如何改变自我认知?The problem: traditional memoirs are monologues — the author writes alone and the book surfaces years later. In the social media era a memoir can become an ongoing conversation. How does that change self-understanding?
- 关键想法:科学史家 Söderqvist 退休后开始在 Facebook 上连载自己人生的片段。一个读者指出,他讲出生故事时语气「完全平静,像 Max von Sydow 的冷面表演」——可他一直以为自己在讽刺。来自他者的反馈让他重新理解了自己笔下的声音。The key idea: after retiring, historian of science Thomas Söderqvist began posting episodes of his life on Facebook. A reader told him his birth-story prose came out 'absolutely flat, like a Max von Sydow deadpan' — though he had thought he was being ironic. Feedback from others made him hear his own voice differently.
- 为什么成立:传统回忆录是孤独劳动,读者只见成稿;连载让读者反馈实时汇入,这些反馈成为作者自我理解的一部分。真正的问题不是「把回忆录放上网会怎样」,而是「当自我形象在公众眼前形成时,发生了什么」。Why it holds: memoir writing is normally solitary labor where readers only see the finished draft; serial posting lets reader reactions flow into the writing in real time and become part of the author's self-understanding. The real question isn't 'what happens when you put a memoir on Facebook' but 'what happens to a self-image when it forms in public'.
- 带走的洞见:一个人的一生能否真的被框成连贯叙事?作者怀疑不能——而他认为这份不确定未必是坏事。公开书写不是自我表达,而是自我发现的持续过程。The takeaway: can a life really be framed into one coherent narrative? The author doubts it — and suspects the uncertainty is a good thing. Public writing is not self-expression but a continuing process of self-discovery.
工具角Tools Corner
- Routeup — 本地应用的稳定 HTTPS 域名Routeup — Stable HTTPS Names for Local Apps
- 点子:本地开发工具每次都给你随机端口号,routeup 给每个应用一个稳定的、浏览器信任的 HTTPS 名字(如 https://example-app.localhost),每次都用同一个 URL。The idea: where local dev tools hand you a random port each time, routeup gives every app a stable, browser-trusted HTTPS name (like https://example-app.localhost) that stays the same across sessions.
- 巧妙之处:本地优先——路由规则留在你自己机器上,不需要账号、token 或依赖他们的服务器;单 Go 二进制、MIT 协议、零遥测。想给别人看时,只把你挑选的路径(如 /api/webhooks/*)经可自托管的隧道暴露出去。顺带内置实时请求状态、可选的 header/body 抓包,兼当本地调试面板。The clever part: local-first — routes stay on your machine with no account, token, or third-party server dependency; single Go binary, MIT-licensed, zero telemetry. When you do want to share, only the paths you pick (say /api/webhooks/*) go through a hosted or self-hostable tunnel. It also embeds live request status with opt-in header/body capture, doubling as a local debug panel.
- grubby — 给 Git 仓库做静态站点的小生成器grubby — A Static Site Generator for Git Repos
- 点子:把一个裸 Git 仓库直接变成可浏览的静态站点——Ruby 写的,重度 fork 自 RepoRat。态度是「opinionated,开箱即用」:默认 Kramdown 渲染 Markdown,要碰的配置只有一个 _config.yml。The idea: turn a bare Git repository straight into a browsable static site — written in Ruby, forked heavily from RepoRat. The stance is 'opinionated, use as-is': Kramdown by default for Markdown, and the only config you're meant to touch is _config.yml.
- 巧妙之处:零服务器依赖。把 .git 结尾的裸仓库放进 web 目录(如 /home/public/git.sitename.org),跑一遍就生成 index.html——对只想用最便宜的静态托管晒出仓库的人,这是「仓库即网站」最薄的实现。The clever part: zero server dependency. Drop your .git bare repo under a web directory (like /home/public/git.sitename.org), run it once, and you get an index.html. For anyone who wants to show a repo off on the cheapest static hosting, it's the thinnest possible 'repo-is-the-website' implementation.