Five hand-written pages and no scratch-outs or corrections. And maybe I'm wrong but I'm pretty sure this wasn't the Nth draft. I don't doubt that he just sat down and wrote it out in one go.<p>(It's so impressive it's almost galling. He makes me feel just a little like Salieri, of Mozart.) <a href="https://en.wikipedia.org/wiki/Amadeus_(film)" rel="nofollow">https://en.wikipedia.org/wiki/Amadeus_(film)</a>
> the syntax for natural numbers, for which there are at least three forms<p>No, this incorrect[0]; consider the number 102, which under the second parse rule yields first the natural number 2, to which a zero is prepended, giving 02, aka... 2; prepending a 1 then produces 12, which is clearly wrong. The third rule has the same problem, nondeterministicly. Only the first rule is correct, producing 1,10,102, by successive multiplication by ten and addition of intermediate digits.<p>This is similar to defining subtraction with:<p><pre><code> sum ::= term
sum ::= term '-' sum
</code></pre>
it may happen to match the same strings, but parsing "1-2-3" as 1-(2-3) produces 2 rather than -4.<p>It's not clear that chop shares this problem, but personally I would much prefer:<p><pre><code> chop 0 x = x
chop (S n) (p:q) = chop n q
</code></pre>
0: or least, you'd need two forms other than the ones provided for "at least three" to be true