In almost two decades at Bell Labs, I learned from many teachers (and especially from Brian Kernighan, whose chapter on the teaching of programming appears as Chapter 1 of this book) that “writing” a program to be displayed in public involves much more than typing symbols. One implements the program in code, runs it first on a few test cases, then builds thorough scaffolding, drivers, and a library of cases to beat on it systematically. Ideally, one mechanically includes the compiled source code into the text without human intervention. I wrote Example 3-1 (and all the code in Programming Pearls) in that strong sense.
Bentley, J. (2007). Chapter 3.4. The Most Beautiful Code I Never Wrote. In A. Oram & G. Wilson (Eds.), Beautiful Code: Leading Programmers Explain How They Think. Sebastopol: CA: O’Reilly.
