2 ms·
This is awesome, and (since it looks like he came up with the setup) I declare Tim Wheeler personally to be awesome. The thing kind of reminds me of the setup
by pjscott 8y ago
This is awesome, and (since it looks like he came up with the setup) I declare Tim Wheeler personally to be awesome.
The thing kind of reminds me of the setup that Robert Sedgewick used for his algorithms textbooks. They've got code snippets, plus a ridiculous number of diagrams that visualize the algorithms step by step on toy inputs. They're an incredible aid to understanding, and nobody would possibly have the patience to draw all those. The book even has extra-wide margins to hold them all!
Somewhere in the book (the preface?) he explains how the hell he drew all of those, and it's a real story. He wrote the code snippets as full self-contained programs that `printf()` some algorithm visualization data as they go along. Then he used some literate programming tool to chop out the inessential parts for the book -- but he runs the programs also, somewhere in his makefile, and gets them to spit out their big list of numbers. He then converts this to a diagram using a widely-known command-line tool called "cat": he wrote a bunch of diagram-drawing programs in PostScript, and they'll have the necessary data waiting on the stack if he just appends them to the output of the code snippets.
- Mageek 8y agoWow! Thank you pjscott. Our approach achieves something similar to what you describe for Robert Sedgewick. Its really interesting to hear how others do it.